[zeromq-dev] Multi-part messages
Martin Lucina
mato at kotelna.sk
Wed Mar 31 11:03:39 CEST 2010
> I'd like to propose the following:
>
> 1) We see that "message options" is a possible extension point. So, let's
> define it with zmq_getmsgopt() and zmq_setmsgopt(). Even if we don't use it
> for anything other than ZMQ_MSG_MORE for the next two years, at least it's
> defined.
>
> 2) Given the above, the construct
>
> zmq_getmsgopt (&msg, ZMQ_MSG_MORE, &have_more, sizeof have_more);
>
> is going to be used extremely frequently. So, we define an additional
> *alias* which is
>
> int /* (boolean TRUE/FALSE) */ zmq_msg_more (&msg);
>
> this is not inconsistent with the other zmq_msg_* functions such as
> zmq_msg_size (), and leads to a nice way of expressing code such as
>
> do {
> rc = zmq_recv (socket, &msg, 0);
> /* process message part */
> } while (zmq_msg_more (&msg));
>
> I think that this fulfills all your defined requirements nicely and can map
> to OO-style language bindings also as msg.more().
3) Define
zmq_send (socket, &msg, ZMQ_MORE)
as the equivalent of setting the ZMQ_MSG_MORE option on msg with
zmq_setmsgopt(), and calling zmq_send () with no special flag.
-mato
More information about the zeromq-dev
mailing list