Interface: InterceptorContext<P, S>
Makaio Framework / bus-core / InterceptorContext
Interface: InterceptorContext<P, S>
Section titled “Interface: InterceptorContext<P, S>”Defined in: ../../../packages/bus-core/src/types/interceptor.ts:14
Context provided to interceptor handlers.
Interceptors run BEFORE event handlers (not request handlers), allowing:
- Payload transformation via
replacePayload() - Event blocking via
stopPropagation() - Sequential execution in priority order (highest first)
Note: Interceptors only work with event subjects. For request/response flow interception, use middleware instead.
Type Parameters
Section titled “Type Parameters”P
S = string
Properties
Section titled “Properties”correlationId
Section titled “correlationId”
readonlycorrelationId:string|undefined
Defined in: ../../../packages/bus-core/src/types/interceptor.ts:18
messageId
Section titled “messageId”
readonlymessageId:string
Defined in: ../../../packages/bus-core/src/types/interceptor.ts:17
payload
Section titled “payload”
readonlypayload:P
Defined in: ../../../packages/bus-core/src/types/interceptor.ts:16
subject
Section titled “subject”
readonlysubject:S
Defined in: ../../../packages/bus-core/src/types/interceptor.ts:15
Methods
Section titled “Methods”next()
Section titled “next()”next():
void
Defined in: ../../../packages/bus-core/src/types/interceptor.ts:36
Explicitly continue to the next interceptor (optional). Continuation is implicit if neither stopPropagation() nor next() is called.
Returns
Section titled “Returns”void
replacePayload()
Section titled “replacePayload()”replacePayload(
newPayload):void
Defined in: ../../../packages/bus-core/src/types/interceptor.ts:30
Replace the payload with a new value. Subsequent interceptors and handlers will receive the new payload.
Parameters
Section titled “Parameters”newPayload
Section titled “newPayload”P
Returns
Section titled “Returns”void
stopPropagation()
Section titled “stopPropagation()”stopPropagation():
void
Defined in: ../../../packages/bus-core/src/types/interceptor.ts:24
Stop propagation of this message. Subsequent interceptors and all handlers will NOT be called.
Returns
Section titled “Returns”void