qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Ivanov <iv...@isle.spb.ru>
Subject Re: proton reply handling again
Date Wed, 18 Feb 2015 08:11:16 GMT
Sorry I still cannot get the reply working :-(

I do the following:

   _sender messenger is created.
   I create a subscription to "amqp://" for this messenger and
   keep the reply address queue:

       s = pn_messenger_subscribe(_sender, "amqp://"));
      _reply_addr = pn_subscription_address(s);

   At this moment I check the qpidd state with qpid-stat -q and verify
   that temporary queue is created.

   At some later tome I prepare the message and set a reply address to is
   as follows:

      pn_message_set_reply_to(message, _reply_addr);

   I verify again with qpid-stat -q, reply queue is still there.

   Now I assign the target address to message and send it:

      pn_messenger_set_timeout(_sender, timeout);
      pn_messenger_put(_sender, msg);
      pn_messenger_send(_sender, -1);

   Immediately before pn_messenger_set_timeout I print the value of
   pn_message_get_reply_to() and it is correct.

   After messenger send I check again with qpid-stat -q and I see that
   the reply queue is gone! Btw, the message is received and executed
   by broker correctly (the actual message is queue create request
   directed to qmf.default.direct, the queue is created properly).

   When I run pn_messenger_recv(_sender, 1) I get an error:

      CONNECTION ERROR (amqp:internal-error) not-found: Exchange not found: \
         amqp: (/Archive/misc/mq/qpid-cpp-0.30/src/qpid/broker/ExchangeRegistry.cpp:144)
      18-Feb-2015 10:49:45.677 @E Error reading messages: no valid sources

   I guess this is because the reply queue has somehow dissappeared.

What's wrong here?

Best regards,

02.02.2015 15:02, Rafael Schloming пишет:
> 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:
> pn_messenger_set_timeout(mainMessenger,
> timeout_that_is_less_than_heartbeat_interval);
> while (...) {
>   pn_messenger_recv(mainMessenger);
>   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.
> --Rafael

 \   / |			           |
 (OvO) |  Михаил Иванов                    |
 (^^^) |      Тел.:    +7(911) 223-1300    |
  \^/  |      E-mail:  ivans@isle.spb.ru   |
  ^ ^  |                                   |

To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org

View raw message