Zeromq regards communication needs as four types, one of which is one-to-one pair communication, which is used to support the traditional TCP socke model, but is not recommended.
There are only three common communication modes:
1. Request Response model. The requester initiates a request and waits for the response to respond to the request. From the perspective of the request end, it must be a pair of sending and receiving pairs;
On the other hand, it must be a sending and receiving pair on the response side. Both the request end and response end can be a 1: n model. Generally, 1 is considered as the server, and N is considered as the client.
0mq can well support the routing function (the component that implements the routing function is called device), and 1: N is extended to N: m (only several routing nodes need to be added ).
From this model, the underlying endpoint address is hidden from the upper layer. Each request has an implicit response address, and the application does not care about it.
2. Publish and subscribe model. In this model, the publisher only sends data in one direction, and does not care whether to send all the information to the subscriber.
If the subscription end is not connected when the publisher starts to publish information, the information is directly discarded.
However, once the subscription end is connected, no information is lost in the middle.
Likewise, the subscriber is only responsible for receiving and not for feedback.
If the publisher and the subscriber need to interact with each other (for example, to confirm whether the subscriber is connected), use an additional socket to meet this requirement using the request response model.
3. MPS queue model. In this model, the pipeline is unidirectional, and the push data stream from the push end is unidirectional to the pull end.
Zeromq, the fastest message queue in history