[zeromq-dev] PUB/SUB protocol (a strawman)

Martin Sustrik sustrik at 250bpm.com
Wed Aug 31 13:38:50 CEST 2011


Hi all,

This is a strawman for how protocol for PUB/SUB pattern could possibly 
look like:

The PUB/SUB protocol is built on top of the underlying of SP framing 
layer (see SP framing I-D).

The PUB/SUB topology is assumed to form a tree. Each node except the 
publisher is connected to exactly one "upstream" node. Every node is 
connected to 0..N "downstream" nodes.

There are "messages" flowing downstream and "subscription commands" 
flowing upstream (if possible).

"Messages" have no SP-specific fields. They are composed entirely of the 
opaque payload defined on the application layer.

"Subscription commands" look like this:

+--------+---------+-------+
| cmd-id | algo-id | query |
+--------+---------+-------+

cmd-id is a 16-bit network byte order unsigned integer specifying the 
action to take. There are two defined values for this field:

1 - subscribe
2 - unsubscribe

algo-id is a 16-bit network byte order unsigned integer that specifies 
the algorithm to use for subscription matching. The values for this 
field are managed by IANA. Possible values are: prefix matching, regexp, 
x-path query, SQL-like selector etc.

query is an arbitrarily large field, spanning from the end of algo-id 
field to the end of the payload. The value of this field is interpreted 
by the algorithm specified by algo-id.

Thoughts?
Martin



More information about the zeromq-dev mailing list