Setu-TS
    Preparing search index...

    Interface IEventBus

    In-memory publish/subscribe event bus for domain events.

    const events = ctx.services.get<IEventBus>(CAPABILITIES.EVENTS);
    events.subscribe<UserCreated>('UserCreated', async (event) => {
    await sendWelcomeEmail(event.data.email);
    });

    0.1.0

    interface IEventBus {
        publish<T>(event: IDomainEvent<T>): Promise<void>;
        publishBatch(events: IDomainEvent<unknown>[]): Promise<void>;
        subscribe<T>(type: string, handler: EventHandler<T>): Unsubscribe;
    }

    Implemented by

    Index