Hub Class
The Hub abstracts low level ZeroMQ communication.
Features:
- 1-1, 1-N req / rep
- message acknowledgements
- retries
- keepalives
It three ZMQ sockets: router, pub and sub.
Constructor
Item Index
Methods
- _sendPub
- _sendRouter
- ack
- bind
- handshake
- onHandshake
- op static
- reply
- routerSocketId static
- sendById
Properties
Methods
_sendPub
(
private
-
buffer
Send a buffer on the pub socket.
Parameters:
-
bufferBuffer
_sendRouter
(
private
-
frames
Send an array of buffers on the router socket.
The first frame must be the socket of the other hub.
Parameters:
-
framesArrayArray of
Buffers.
ack
(
-
msg
Acknowledge the receival of a message by sending an _ack message.
Parameters:
-
msgMessage
bind
()
Bind the router and pub sockets. The hub can now send/receive messages.
handshake
(
-
hub -
callback
Connect the hub to another hub.
op
(
RetryOperation
static
-
options
Parameters:
-
optionsObjectSame options as
retry.operation(options)
Returns:
RetryOperation:
reply
(
-
msg -
[data] -
[callback]
Reply to a message. Pass in a callback if you're expecting a reply.
Properties
_machine
Stately
private
The hub's state machine.
messageFactory
MessageFactory
The hub's message factory. Used to create all messages sent.
routerSocketId
Buffer
The id of the hub's router socket. Other nodes use this to send messages us messages from their router sockets.
Default: null
