nanomsg使用记录--模式说明

2018-03-26  本文已影响0人  yanshaowen

1 PAIR 模式

pair.png

simple one-to-one communication。

一对一连接,也就是一个nod0只能同时连接有一个node1,node的send是不阻塞的。recv是阻塞的,直到recv超时或者接到到对方的send。

2 PIPELINE模式

pipeline.png
aggregates messages from multiple sources and load balances them among many destinations。

聚合来自多个来源的消息,并在多个目的地之间进行负载平衡。node0只能send,node1只能recv。

3 REQREP模式

reqrep.png

allows to build clusters of stateless services to process user requests

允许构建集群的无状态服务来处理用户请求。每个req请求都需要rep响应,类似http协议(一应一答)。

4 PUBSUB 模式

pubsub.png

distributes messages to large sets of interested subscribers

发布者向订阅者推送消息。只有订阅该频道的订阅者才能收到该频道的消息。

5 SURVEY模式

survey.png

allows to query state of multiple applications in a single go。

查询多个应用的状态。这种模式对于服务发现和投票算法非常有用。

6 BUS模式

bus.png

simple many-to-many communication。

多对多通信。在此模式中,消息被发送到每个直接连接的对等点。

上一篇 下一篇

猜你喜欢

热点阅读