ZMQ Important points
ZMQ is widely used as a reliable & easy-to-use replacement of sockets
Sync & A-Sync style sockets
In ZMQ, the sockets can be classified into two different categories:
- Sync: like REQ/REP
- Async: DEALER/ROUTER
Envelope
The concept of envelope is used to identify the source of each message.
For REQ socket,
- Send the message: REQ will prepend a empty frame to the real message.
- Receive the message: strips every frame including empty frame.
For REP socket:
- Receive the message: Will strip frames including empty frame, then return the rest of the message to application.
- Send the message: Prepend the message with saved envelope.
For ROUTER socket:
- Receive the message: prepend identify frame automatically
- Send the message: Remove the identity frame and check existence of the identity.
For DEALER socket: Do nothing, will send whatever you want in the message.
Written with StackEdit.
没有评论:
发表评论