[zeromq-dev] exchange id issue.

Aamir M intuitionist at gmail.com
Wed Mar 18 18:09:12 CET 2009


Are there performance implications with using scope_process instead of

Also, it sounds like scope_local is not something the user should ever use?


On Wed, Mar 18, 2009 at 1:03 PM, Martin Sustrik <sustrik at fastmq.com> wrote:

> Hi Alexandre,
> > I found what may be a defect in the exchange id attribution.
> >
> > This is my use case:
> > - the main thread of my program create an api_thread_t and use it to
> > create a process scope exchange.
> > - a spawned thread create an api_thread_t and use it to create a thread
> > scope exchange.
> >
> > Both exchange have the same exchange_id, therefore, I can't use the
> > process scope exchange from my spawned thread (message are delivered
> > through the thread scope exchange). As exchanges are passed to
> > api_thread_id::send() by exchange id, should they not have different id?
> No. The idea is that you can used object you've created only from that
> particular thread (this is needed because internally, exchanges and
> queues are represented as ultra-efficient lock-free queues that can be
> accessed only by a single thread at a moment.)
> If what you need is a "shared queue", i.e. an object that can be written
> to by many applications and from which many applications can fetch data,
> you should create a simple application that does the thing. Have a look
> at chat example. The "chatroom" component is actually a shared queue.
> In most cases the code boils down to something like this:
> int eid = api->create_exchange ("E");
> api->create_queue ("Q");
> while (true) {
>     message_t message;
>     api->receiver (&message);
>     api->send (eid, message);
> }
> At some time in the future we'll ship pre-packaged shared queue
> implementation with 0MQ, however, at the moment you have to write
> something like the code above yourself.
> Hope this helps.
> Martin
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20090318/961883b6/attachment.htm>

More information about the zeromq-dev mailing list