chore: group & release events for local eventbus (#7649)

* chore: stage & release events for local eventbus

* chore: address review

* chore: mock emitter correctly
This commit is contained in:
Riqwan Thamir
2024-06-07 15:31:16 +02:00
committed by GitHub
parent c9c2b6c88f
commit fbb00f3863
5 changed files with 237 additions and 71 deletions

View File

@@ -24,6 +24,16 @@ export abstract class AbstractEventBusModuleService
abstract emit<T>(data: EventBusTypes.EmitData<T>[]): Promise<void>
abstract emit<T>(data: EventBusTypes.Message<T>[]): Promise<void>
/*
Grouped events are useful when you have distributed transactions
where you need to explicitly group, release and clear events upon
lifecycle events of a transaction.
*/
// Given a eventGroupId, all the grouped events will be released
abstract releaseGroupedEvents(eventGroupId: string): Promise<void>
// Given a eventGroupId, all the grouped events will be cleared
abstract clearGroupedEvents(eventGroupId: string): Promise<void>
protected storeSubscribers({
event,
subscriberId,