Runtime hooks engine
The following hooks can be used:
Message sending
onSend
- passed an array ofSendEvent
objects. The messages inside these objects are exactly what the node has passed tonode.send
- meaning there could be duplicate references to the same message object.preRoute
- passed aSendEvent
preDeliver
- passed aSendEvent
. The local router has identified the node it is going to send to. At this point, the message has been cloned if needed.postDeliver
- passed aSendEvent
. The message has been dispatched to be delivered asynchronously (unless the sync delivery flag is set, in which case it would be continue as synchronous delivery)onReceive
- passed aReceiveEvent
when a node is about to receive a messagepostReceive
- passed aReceiveEvent
when the message has been given to the node'sinput
handler(s)onComplete
- passed aCompleteEvent
when the node has completed with a message or logged an error
add(hookId, callback)
Register a handler to a named hook
Parameters:
Name | Type | Description |
---|---|---|
hookId |
String
|
the name of the hook to attach to |
callback |
function
|
the callback function for the hook |
remove(hookId)
Remove a handled from a named hook
Parameters:
Name | Type | Description |
---|---|---|
hookId |
String
|
the name of the hook event to remove - must be |