[zeromq-dev] Queue + "sequencer"
Martin Sustrik
sustrik at fastmq.com
Fri Jun 12 09:12:35 CEST 2009
Hi Dragan,
> I was just wondering if anybody has experienced issue with various queue
> mechanism and need to specify a unique sequence/id in that same queue ?
> Is standard practice to use some external 'sequence generator' or
> so,obtain an id and then insert it into queue,or there's any internal
> mechanism where You may insert Your data into queue and the queue
> server/manager/whatever will give You back the unique sequence/id of
> that exact message in the queue ?
Assigning sequence numbers makes sense in a shared queue. Note that 0MQ
has no in-build shared queue, instead you have to implement it yourself.
It's pretty simple (pseudocode):
int eid = create_exchange ("E", scope_global);
create_exchange ("Q", scope_global);
while (true) {
message_t msg;
receive (&msg);
send (eid, msg);
}
It's easy to attach a sequence number to the message after it is
received and before it is sent further.
Martin
More information about the zeromq-dev
mailing list