[zeromq-dev] Multi-part messages
Martin Sustrik
sustrik at 250bpm.com
Sat Mar 27 19:00:26 CET 2010
Hi Brian,
>> No API for it now. I have no sane idea how the API should look like :(
>>
>> As an workaround you can check the flag by hand:
>>
>> zmq_msg_t msg;
>> ...
>> int tbc = msg.flags & ZMQ_MSG_TBC ? 1 : 0;
>
> I guess this is the API then :) I will think about how to represent
> this in Python.
Any idea is welcome. I've made up a list of requirements to figure out
how the API should look like:
1. When multi-part messages are not used, the API should be 100%
backward compatible. In other words, those not using multi-part messages
shouldn't be required to have a slightest idea about it.
2. When forwarding messages, message part boundaries should be retained:
while (true) {s1.recv (&msg); s2.send (msg);}
In other words, TBC flag should be part of the message rather than part
of the zmq_send/zmq_recv invocation.
Another consequence is that zmq_msg_move and zmq_msg_copy should copy
the TBC flag.
3. Generic requirement: We should avoid API creep; it not possible we
should use generic extension points rather than single-purpose constructs.
The only solution that matches the above criteria I was able to think of
was zmq_setmsgopt, zmq_getmsgopt and ZMQ_TBC message option. Still, it
seems rather complex... The BSD alternative is ancillary data which is
pretty hideous API itself...
Thoughts?
Martin
More information about the zeromq-dev
mailing list