qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rafael Schloming <...@alum.mit.edu>
Subject Re: proton reply handling again
Date Mon, 02 Feb 2015 12:02:13 GMT
On Mon, Feb 2, 2015 at 4:46 AM, Michael Ivanov <ivans@logit-ag.de> wrote:

> Hallo!
> I am implementing message handling event loop using proton library.
> I create a pm_messenger, subscribe to several incoming queues and wait
> for input. I also need to send outgoing messages when handling incoming
> ones and for some of the outgoing messages I want to get an immediate
> reply (which has to be received outside of the main event loop). To get
> a reply I use a temporary queue (created using "#" token). As far as I
> understand I should not subscribe to this queue in my primary messenger,
> since I cannot temporary suspend or cancel other subscriptions, which
> have to be handled in primary event loop. So at the start of a process,
> I create a separate pn_messenger for immediate replies, subscribe it
> to the temporary queue and use wherever I need the reply. Can you
> confirm that this second messenger will not conflict with the primary
> one, in particular that when I read the reples the input pending for
> the queues to which the primary messenger is subscribed will not be
> affected in any way?

They shouldn't interfere with each other. The only caveat here is that they
can only perform I/O when you pass control to them, so if you have
heartbeats enabled, you need to be sure to pass control back to each one
frequently enough. It's a bit awkward, but you can work around this by
using a timeout that is smaller than your heartbeat timeout, e.g.:

// main loop:
while (...) {
  pn_messenger_work(secondaryMessenger, 0);

Another issue: as I can see neither pm_messenger_recv nor pn_messenger_get
> hae a timeout option. Do I miss sthing or to get a timeout for message
> input I need to use a selectables together with poll or select syscall?

There is a pn_messenger_get/set_timeout that you can use to control the
default timeout for any blocking operations. Also if you use
pn_messenger_work(), you can pass in the timeout explicitly.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message