On 09/08/2015 10:53 AM, AlexandreLambin wrote:
Hello,

I'm looking for the best solution to solve a problem I have in my usage of
qpid-cpp client api.
I have a request/reply mechanism between a server and a client but the
client has a timeout to avoid waiting too long in some case.
When the timeout is reached, the client closes the temporary reception queue
so the server get the exception "Queue not found".
The exception itself is not an issue if I receive it only once, but I have
it every time I call nextReceiver(). So my thread start to take 100% of CPU
and I cannot process the next request. The sessions seems stuck on the
exceptionfor ever.

That is correct. For AMQP 0-10 when an 'Execution.Exception' is received from the server, the session can no longer be used.

It seems that the only way is to disconnect the session which is not
something I want to do.

I found a workaround by adding the option "create: always" when I create the
Sender to reply but I'm not sure it's the best way to do.

The problem with that is that then the queue is created and a response is sent to it, but nothing will ever consume that response.

One option would be to have the client bind the reply queue to some agreed exchange and have the reply-to use that exchange.

E.g.

   Receiver receiver = session.createReceiver("amq.direct/abc");
   Address replyTo = receiver.getAddress();
   replyTo.setType("topic");
   //...
   Message request;
   request.setReplyTo(replyTo);

The 'abc' part must be unique for each client. Any exchange can be used, I've just used amq.direct here for convenience since that is precreated.




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

Reply via email to