Pipeline pattern 管道模式。
这种模式描述的场景是数据被散布到以管道方式组织的各个节点上。管道的每一步都连接一个或多个节点,连接多个节点时数据以RR方式往下流。
注意是流,意味着数据跟发布模式一样是单向的。这个模式对应的socket是ZMQ_PUSH和ZMQ_PULL.
ZMQ_PUSH
用来向下游节点发消息。下游多个节点时采取RoundRobin分发,zmq_recv()对于这个socket也是无效的。
与Pub不同的是,当下游节点达到高水位(HWM)或者根本没有下游节点时,zmq_send()就阻塞了,消息并不丢失。
Summary of ZMQ_PUSH characteristics | |
---|---|
Compatible peer sockets | ZMQ_PULL |
Direction | Unidirectional |
Send/receive pattern | Send only |
Incoming routing strategy | N/A |
Outgoing routing strategy | Round-robin |
ZMQ_HWM option action | Block |
Summary of ZMQ_PULL characteristics | |
---|---|
Compatible peer sockets | ZMQ_PUSH |
Direction | Unidirectional |
Send/receive pattern | Receive only |
Incoming routing strategy | Fair-queued |
Outgoing routing strategy | N/A |
ZMQ_HWM option action | N/A |