Interface: OnOptions
Makaio Framework / bus-core / OnOptions
Interface: OnOptions
Section titled “Interface: OnOptions”Defined in: ../../../packages/bus-core/src/types/options.ts:14
Options for subscribing to events/requests via on().
Properties
Section titled “Properties”filter?
Section titled “filter?”
optionalfilter?: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.
Example
Section titled “Example”bus.on(Subjects.message, handler, { filter: { agentId: 'agent-123', status: { $in: ['active', 'pending'] }, }});handlerKind?
Section titled “handlerKind?”
optionalhandlerKind?:"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.
priority?
Section titled “priority?”
optionalpriority?: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.
Example
Section titled “Example”// Authentication runs first (highest priority)bus.on(Subjects.request, authHandler, { priority: 100 });
// Logging runs nextbus.on(Subjects.request, logHandler, { priority: 50 });
// Business logic runs last (default priority)bus.on(Subjects.request, businessHandler);