π
π
π
π
@node-test/bus
Searchβ¦
π
π
π
π
@node-test/bus
@node-ts/bus
Getting started
Reference
Getting help
Guide
Messages
Message attributes
Workflows
Transports
Persistence
Serializers
Loggers
Middleware
Lifecycle hooks
Retry Strategies
Dependency injection
Long running processes
Powered By
GitBook
Lifecycle hooks
@node-ts/bus
exposes a number of lifecycle hooks that can be subscribed to. These are
EventEmitter
instances that follow the standard node
.on()
and
.off()
notation.
Hooks
beforeSend
called just before a command is sent to the underlying transport
1
bus.beforeSend.on(({ command, attributes }) => {})
Copied!
beforePublish
called just before a event is published to the underlying transport
1
bus.beforePublish.on(({ event, attributes }) => {})
Copied!
afterReceive
called after a message has been read from the queue, and before it is dispatched to handlers
1
bus.afterReceive.on(transportMessage => {})
Copied!
beforeDispatch
called before a message is dispatched to its handlers
1
bus.beforeDispatch.on(({ message, attributes, handlers }) => {})
Copied!
afterDispatch
called after a message has been successfully handled and the message deleted from the transport
1
bus.afterDispatch.on(({ message, attributes }) => {})
Copied!
onError
called when an error occurred reading/dispatching/handling a message
1
bus.onError.on(({ message, error, attributes, rawMessage }) => {})
Copied!
Guide - Previous
Middleware
Next - Guide
Retry Strategies
Last modified
7mo ago
Copy link
Contents
Hooks