Function createSimpleEventBroker

Factory for creating local event brokers with domain event handlers.

const broker = createSimpleEventBroker([
new OrderValidationHandler(),
new OrderProcessingHandler()
]);

await broker.publish({
to: 'order.validate',
payload: orderData
});
  • Parameters

    • eventHandlers: AbstractArvoEventHandler[]

      Handlers to register with the broker

    • OptionalonError: ((error: Error, event: ArvoEvent<Record<string, any>, Record<string,
          | null
          | string
          | number
          | boolean>, string>) => void)

      Optional custom error handler

        • (error, event): void
        • Parameters

          • error: Error
          • event: ArvoEvent<Record<string, any>, Record<string,
                | null
                | string
                | number
                | boolean>, string>

          Returns void

    Returns SimpleEventBroker

    Configured event broker