On 01/09/2014 07:46 PM, Shearer, Davin wrote:
I am trying to build a transport library in C using proton with support for
a qpid broker.  What I need to do is create a reply queue.  The AMQP 1.0
spec covers creating Dynamic Reply-To.  The problem I'm having is in
garbage collection of the abandoned queues as these queues have a permanent
lifetime policy.  If I were using qpid (rather than proton) I could simply
have the client create the queue using a name of its choice with the
DeleteOnClose lifetime policy and I also set exclusive to true and I get
exactly what I need, but it this ties me to qpid.

You can create a temporary queue when using the qpid::messaging client by simply specifying '#' as the node name in the address when creating the receiver or sender. You can get the peer-assigned address (for use in reply-to) via the getAddress() method on the Sender or Receiver instance that is returned.

This uses completely standard AMQP 1.0 underneath - it sets the dynamic flag on the source/target and by default will request the delete-on-close lifetime policy (the others can be requested via node-properties in the address).

Again, this is standard AMQP 1.0, nothing proprietary. It works with the qpid brokers but also e.g. ActiveMQ, ApolloMQ, HornetQ and should work with any broker that supports the dynamic flag.

Using proton messenger there is at present no way to set the dynamic flag or control the source/target beyond the address.

With ApolloMQ you can create a policy that will be applied if the name of the node matches, and that policy can specify the queue should be automatically deleted. The qpid c++ broker supports something every similar in the upcoming 0.26 (using the AMQP 1.0 lifetime-policy options). This allows the desired behaviour to be configured broker side.

With RabbitMQ you could creating a receiving link from /exchange/amq.direct/unique-name (where unique name is e.g. a client specified UUID). That address can be given as the reply to, and when the receiver exits there will be no queue left. Unfortunately this trick doesn't work with the qpid brokers, which at present require the binding to be specified as a filter.

So unfortunately at present I think it is not possible to do what you want using the java broker and proton messenger. If you can use qpid::messaging (which doesn't tie you to qpid brokers), that should work. If you can't, then you can request changes to proton messenger or - better in my view - request other brokers to support the policy driven approach from ApolloMQ (and now qpid c++!).

(If I have got the wrong end of the stick and you are using the proton *engine* API, then it is indeed possible. You just set the dynamic flag on the terminus for the link. I can point you to the code in qpid::messaging that does this if it is of interest).



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

Reply via email to