EventBusService
Can keep track of multiple subscribers to different events and run the subscribers when events happen. Events will run asynchronously.
Implements
Properties
__configModule__
Record<string, unknown>__container__
anyRequired__moduleDeclaration__
Record<string, unknown>enqueue_
Promise<void>Requiredmanager_
EntityManagerRequiredshouldEnqueuerRun
booleanRequiredtransactionManager_
undefined | EntityManagerRequiredAccessors
activeManager_
Returns
EntityManager
EntityManagerRequiredeventBusModuleService_
Returns
Methods
atomicPhase_
Wraps some work within a transactional block. If the service already has a transaction manager attached this will be reused, otherwise a new transaction manager is created.
Parameters
work
(transactionManager: EntityManager) => Promise<TResult>RequiredisolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Returns
Promise
Promise<TResult>Requiredemit
**emit**<TypeParameter T>(data): Promise<void \| [StagedJob](/references/js-client/internal/classes/internal.internal.StagedJob)[]>
Calls all subscribers when an event occurs.
Parameters
Returns
**emit**<TypeParameter T>(eventName, data, options?): Promise<void \| [StagedJob](/references/js-client/internal/classes/internal.internal.StagedJob)>
Calls all subscribers when an event occurs.
Parameters
eventName
stringRequireddata
TRequiredoptions
Record<string, unknown>Returns
enqueuer_
Returns
Promise
Promise<void>RequiredlistJobs
Parameters
Returns
shouldRetryTransaction_
Parameters
err
Record<string, unknown> | { code: string }RequiredReturns
boolean
booleanstartEnqueuer
Returns
void
voidstopEnqueuer
Returns
Promise
Promise<void>Requiredsubscribe
Adds a function to a list of event subscribers.
Parameters
event
string | symbolRequiredcontext
SubscriberContextReturns
unsubscribe
Removes function from the list of event subscribers.
Parameters
event
string | symbolRequiredReturns
withTransaction
Parameters
transactionManager
EntityManager