-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: event emitter durable listener #1248
base: master
Are you sure you want to change the base?
feat: event emitter durable listener #1248
Conversation
lib/event-subscribers.loader.ts
Outdated
@@ -128,9 +130,10 @@ export class EventSubscribersLoader | |||
listenerMethod( | |||
event, | |||
async (...args: unknown[]) => { | |||
const contextId = ContextIdFactory.create(); | |||
const request = this.getRequestFromEventPayload(args); | |||
const contextId = ContextIdFactory.getByRequest({ payload: request }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is a conscious choice I have made.
There is no access to the original request object at this time, so in order to decide the request object for the strategy, I decided to use the event payload.
I prefixed with the payload key, since the request object is of expected type Record<string, any>
, while payload can also be any non-object or array.
There are probably some document fixes which are required, specifically in: https://docs.nestjs.com/techniques/events |
cde4a7c
to
1290ad2
Compare
Currently stuck due to typescript-eslint/typescript-eslint#10338 |
1290ad2
to
cde4a7c
Compare
a6a64e3
to
0fd62e4
Compare
0fd62e4
to
7aaef61
Compare
Managed to commit by undoing the rebase, committing, and rebasing anew. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number:
#1247
What is the new behavior?
Durable injectable with declared subscribers will be loaded as durable.
Context strategy will use the event payload as the request object for the context strategy.
Does this PR introduce a breaking change?
Existing request subscribers within durable injectables will now fail to load unless the context strategy can resolve based on the payload, unlike before, where they simply behaved as non-durable.
Other information