[zeromq-dev] subscription format changed in 0MQ/2.0 trunk
Martin Sustrik
sustrik at 250bpm.com
Mon Dec 28 21:43:00 CET 2009
Hi all,
Those using 0MQ/2.0 from trunk should note that the subscription format
have changed as previously announced here:
http://lists.zeromq.org/pipermail/zeromq-dev/2009-December/001540.html
Now the subscription (ZMQ_SUBSCRIBE socket option) is simply a prefix
that message has to have not to be filtered out. There's no need for *
symbol anymore.
Examples:
Subscribe for all messages (empty prefix):
zmq_setsockopt (s, ZMQ_SUBSCRIBE, "", 0);
Subscribe for all messages starting with "ABC":
zmq_setsockopt (s, ZMQ_SUBSCRIBE, "ABC", 3);
Subscribe for all messages starting with "ABC" followed by binary zero
as a delimiter:
zmq_setsockopt (s, ZMQ_SUBSCRIBE, "ABC\x00", 4);
Advantages:
1. Message doesn't have to follow any predefined format (before this
change message was required to start with size-prefixed topic string).
2. The size of the topic/subscription string is unbound (before it was
bound to at most 255 bytes).
3. Asterisk is considered a normal character (before it was reserved as
a wildcard).
Martin
More information about the zeromq-dev
mailing list