-
Notifications
You must be signed in to change notification settings - Fork 5
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
AP-4870 async event handlers support #201
Conversation
CommonEventDefinitionPublisherSchemaType<CommonEventDefinition> = CommonEventDefinitionPublisherSchemaType<CommonEventDefinition>, | ||
> = { | ||
readonly eventHandlerId: string | ||
handleEvent(event: EventDefinitionSchema): void | Promise<void> | ||
} |
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.
We need to add this to be able to add observability on bg handlers
// not sure if we should use startWithGroup or start, using group to group all handlers for the same event type | ||
// should it be eventId + eventType or just eventType? | ||
this.transactionObservabilityManager?.startWithGroup( | ||
this.buildTransactionKey(event, handler), | ||
transactionId, | ||
event.type, | ||
) |
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.
Please share your thoughts 🙏! If you agree I will remove the comment
background: [], | ||
} | ||
|
||
const fgHandlers = [...eventHandlers.foreground, ...this.anyHandlers.foreground] |
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.
it seems a bit wasteful to repopulate this on every event. can we do that after handler is attached instead?
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.
Discussed on Slack, for visibility:
To avoid creating this array with every event, we moved any handler to eventHandlerMap
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.
Already done :D
const transactionId = randomUUID() | ||
let isSuccessfull = false | ||
try { | ||
this.transactionObservabilityManager?.startWithGroup( |
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.
yeah, I'd say it makes sense to use startWithGroup here
No description provided.