Class: AbstractEventListener

fabric-network. AbstractEventListener

Event listener base class handles initializing common properties across contract, transaction and block event listeners. Instances of the event listeners are stateful and must only be used for one listener

new AbstractEventListener(network, listenerName, eventCallback, options)

Constructor
Parameters:
Name Type Description
network module:fabric-network.Network The network
listenerName string a unique name identifying the listener.
eventCallback function The function called when the event is triggered. It has signature (err, ...args) where args changes depending on the event type
options module:fabric-network.Network~ListenerOptions Event handler options

Methods


getCheckpointer()

Returns the checkpoint instance created by the checkpoint factory
Returns:
Checkpointer instance specific to this listener
Type
BaseCheckpointer

getEventHubManager()

Returns the event hub manager from the network
Returns:
Event hub manager
Type
EventHubManager

isregistered()

Returns:
Listeners registration status
Type
boolean

<async> register()

Called by the super classes register function. Saves information needed to start listening, and disconnects an event hub if it is the incorrect type

setEventHub(eventHub, isFixed)

Parameters:
Name Type Description
eventHub ChannelEventHub Event hub.
isFixed boolean If true only this peers event hub will be used

unregister()

Called by the super classes unregister function.