EventBusService
Can keep track of multiple subscribers to different events and run the subscribers when events happen. Events will run asynchronously.
constructor
Parameters
__namedParameters
InjectedDependenciesRequiredconfig
anyRequiredisSingleton
booleanRequiredDefault: true
Properties
__container__
anyRequiredenqueue_
Promise<void>Requiredmanager_
EntityManagerRequiredshouldEnqueuerRun
booleanRequiredtransactionManager_
undefined | EntityManagerRequired__configModule__
Record<string, unknown>__moduleDeclaration__
Record<string, unknown>Accessors
activeManager_
Returns
EntityManager
EntityManagerRequiredeventBusModuleService_
Returns
IEventBusModuleService
objectRequiredMethods
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.
Type Parameters
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>Requiredthe transactional work to be done
isolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>the isolation level to be used for the work.
maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Potential error handler
Returns
Promise
Promise<TResult>Requiredthe result of the transactional work
emit
**emit**<TypeParameter T>(data): Promise<void \| [StagedJob](/references/entities/classes/StagedJob)[]>
Calls all subscribers when an event occurs.
Type Parameters
T
objectRequiredParameters
The data to use to process the events