Skip to content

Interface: OnOptions

Makaio Framework


Makaio Framework / bus-core / OnOptions

Defined in: ../../../packages/bus-core/src/types/options.ts:14

Options for subscribing to events/requests via on().

optional filter?: PayloadFilter

Defined in: ../../../packages/bus-core/src/types/options.ts:41

Declarative payload filter for smart-routing.

Applied both locally (before handler invocation) and can be sent to transports for server-side filtering.

All conditions are ANDed together.

bus.on(Subjects.message, handler, {
filter: {
agentId: 'agent-123',
status: { $in: ['active', 'pending'] },
}
});

optional handlerKind?: "request" | "event" | "both"

Defined in: ../../../packages/bus-core/src/types/options.ts:23

Explicit handler registry target for wildcard subjects.

Exact subjects derive their registry from the subject schema. Wildcard subjects can match both events and requests, so callers that know their intent can pin the registration to event-only or request-only. Omit this option to preserve the historical ambiguous wildcard behavior.


optional priority?: number

Defined in: ../../../packages/bus-core/src/types/options.ts:59

Handler priority for middleware-style ordering.

Higher values run earlier. Default is 0. Handlers with equal priority preserve registration order.

// Authentication runs first (highest priority)
bus.on(Subjects.request, authHandler, { priority: 100 });
// Logging runs next
bus.on(Subjects.request, logHandler, { priority: 50 });
// Business logic runs last (default priority)
bus.on(Subjects.request, businessHandler);