createCqrs
Αυτό το περιεχόμενο δεν είναι ακόμη διαθέσιμο στη γλώσσα σου.
createCqrs(
options?):Cqrs
Defined in: packages/cqrs/src/create-cqrs.ts:76
Creates the command, query and event buses with no container: the application builds
its handlers with new and registers them. Global behaviors are built here, so one
whose required dependency is missing fails at once.
Parameters
Section titled “Parameters”options?
Section titled “options?”CqrsOptions = {}
Returns
Section titled “Returns”Throws
Section titled “Throws”TypeError on two instances of one behavior class.
Example
Section titled “Example”const cqrs = createCqrs({ behaviors: [new AuditBehavior(sink)], globalBehaviors: { before: [LoggingBehavior] }, sources: { tenantId: tenantSource, correlationId: correlationSource },});cqrs.register(new CreateUserHandler(users, cqrs.eventBus), new GetUserHandler(users));
const id = await cqrs.commandBus.execute(new CreateUserCommand('Ann'));await cqrs.close();