nanomsg使用记录--模式说明
2018-03-26 本文已影响0人
yanshaowen
1 PAIR 模式

simple one-to-one communication。
一对一连接,也就是一个nod0只能同时连接有一个node1,node的send是不阻塞的。recv是阻塞的,直到recv超时或者接到到对方的send。
2 PIPELINE模式

aggregates messages from multiple sources and load balances them among many destinations。
聚合来自多个来源的消息,并在多个目的地之间进行负载平衡。node0只能send,node1只能recv。
3 REQREP模式

allows to build clusters of stateless services to process user requests
允许构建集群的无状态服务来处理用户请求。每个req请求都需要rep响应,类似http协议(一应一答)。
4 PUBSUB 模式

distributes messages to large sets of interested subscribers
发布者向订阅者推送消息。只有订阅该频道的订阅者才能收到该频道的消息。
5 SURVEY模式

allows to query state of multiple applications in a single go。
查询多个应用的状态。这种模式对于服务发现和投票算法非常有用。
6 BUS模式

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