qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fraser Adams <fraser.ad...@blueyonder.co.uk>
Subject Re: How to use lifetime policies
Date Fri, 10 Jan 2014 09:15:13 GMT
I doubt that I can give any sort of definitive answers here as my 
experience of AMQP 1.0 is barely off the n00b level yet, but RE: "

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

"there
This sounds like what you are actually looking for is to be able to set 
your queue to be exclusive and auto-delete, which is certainly something 
that you can do with qpid::messaging and JMS (at least for AMQP 0.10).

I'd be surprised if you couldn't do this for AMQP 1.0, but there seems 
to be rather a lot of differences between the two and I'm still waiting 
for a set of "AMQP 1.0 for AMQP 0.10 users" documents to be written by 
someone who knows (hint hint :-))


My guess is that Gordon Sim might be able to help you out if he's 
reading this, it is Gordon who has written the AMQP 1.0 support for 
qpid::messaging and I believe that this is based on the Proton engine 
API so it's pretty likely that if setting the policies you require is 
possible then Gordon will know how to do it - though that said there's 
no guarantee that if it's possible to do with Proton engine that it'll 
be also supported on the Proton messenger API, but I'd be surprised if 
not (though messenger abstracts connection/session concepts so there are 
definitely conceptual differences).

I'm much more familiar with qpid::messaging/JMS myself and I'd be quite 
keen for some guidance on AMQP 1.0 Addressing and examples of say how to 
write something in messenger that could publish or subscribe to things 
that I'm familiar with - most of my current use cases publish to 
amq.match - the default headers exchange and subscribe by using 
x-bindings. Over time I'll migrate to message selectors, but in the 
short term I'd love to know how to go about getting this stuff 
interoperable.

As Robbie mentioned I've done a fair bit of work on QMF, though it's 
worth pointing out that the underlying implementation is built on JMS 
and currently uses the AMQP 0.10 client, I'll need to give things a bit 
of a shake through when I get more familiar with AMQP 1.0, but it's 
worth mentioning that the longer term journey should really be to enable 
AMQP 1.0 Management support - again something that I need to do when I'm 
a bit more familiar and have a bit of time.

The Java Broker QMF plugin that I put together (take a look in 
qpid/tools/src/java) is pretty decent, though one of the quirks is that 
there are a number of differences in the underlying management models 
between the C++ and Java brokers. I've mapped a fair amount to cover off 
the most common use cases but for Java Broker specific things there are 
likely to be gaps.

If you are using Java there are examples in 
qpid/tools/src/java/src/main/java/org/apache/qpid/qmf2/tools the 
QpidConfig example shows how to add and remove queues. The QMF stuff 
responds to the QMF map message protocol, so you can also use the Python 
qpid-config to add/delete queues (and you could lift code from that if 
you're programming in Python) for C++ you'd have to resort to writing 
map messages directly. I'm a bit rusty on that as I've tended to use the 
API but I could probably dig out some examples that Gordon put together 
if you are interested.


That said in your mail you say "It seems that I can create queues with 
the DeleteOn* lifetime policies using REST, but then the queues are 
immediately deleted. " I guess it doesn't seem to make sense to me to 
try and create a queue with an auto delete policy with either QMF or the 
Java Broker REST API because auto delete means that the queue gets 
deleted after the last connection to it goes away, so "but then the 
queues are immediately deleted " would be what I'd expect.

Given my last paragraph I still reckon your best bet is to hope Gordon 
(or Rafael Schloming) can suggest how to establish auto delete/exclusive 
behaviour in Proton - given my comments about such things getting zapped 
after the last connection goes I'd be surprised if it's not something 
that can be applied as part of the queue Node creation.

Regards,
Frase


On 09/01/14 19:46, Shearer, Davin wrote:
> Hello,
>
> Is there a way, using proton and QMF to create a queue that has a lifetime
> policy other than permanent?  If so, how?
>
> 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.
>
> Instead, what I want to do is use proton for the AMQP 1.0 messaging and for
> queue management use the vendor-specific management framework (so for qpid,
> it is QMF).  This means that if I need to support other vendor's broker, I
> extend the queue management functions with support for that vendor's
> specific management framework and the actual messaging (since its AMQP 1.0)
> just uses proton.
>
> My thought is to use the qpid java broker's REST interface for queue
> creation.  It seems that I can create queues with the DeleteOn* lifetime
> policies using REST, but then the queues are immediately deleted.
>
> bash$ for policy in DeleteOnClose DeleteOnNoLinks DeleteOnNoLinksOfMessages
> DeleteOMessages; do echo "Policy: $policy"; curl -X PUT -u
> webadmin:webadmin -d "{\"durable\":true,\"lifetimePolicy\":\"${policy}\"}"
> http://localhost:8080/rest/queue/default/test_queue; curl -X GET -u
> webadmin:webadmin http://localhost:8080/rest/queue/default/test_queue;
> echo; done
> Policy: DeleteOnClose
> [ ]
> Policy: DeleteOnNoLinks
> [ ]
> Policy: DeleteOnNoLinksOfMessages
> [ ]
> Policy: DeleteOMessages
> [ ]
>
> Also if I just create the queue, then try to change attributes later, the
> changes are ignored:
>
> curl PUT -u webadmin:webadmin -d '{}'
> http://localhost:8080/rest/queue/default/test_queue
> curl -X GET -u webadmin:webadmin
> http://localhost:8080/rest/queue/default/test_queue
> [ {
>    "id" : "f280eb22-8110-3d2b-91d3-f68192c8d1b7",
>    "name" : "test_queue",
>    "state" : "ACTIVE",
>    "durable" : false,
>    "lifetimePolicy" : "PERMANENT",
>    "type" : "standard",
>    "exclusive" : false,
>    "maximumDeliveryAttempts" : 0,
>    "queueFlowControlSizeBytes" : 0,
>    "queueFlowResumeSizeBytes" : 0,
>    "queueFlowStopped" : false,
>    "alertThresholdMessageAge" : 0,
>    "alertThresholdMessageSize" : 0,
>    "alertThresholdQueueDepthBytes" : 0,
>    "alertThresholdQueueDepthMessages" : 0,
>    "alertRepeatGap" : 30000,
>    "statistics" : {
>      "unacknowledgedBytes" : 0,
>      "bindingCount" : 0,
>      "queueDepthBytes" : 0,
>      "queueDepthMessages" : 0,
>      "totalEnqueuedBytes" : 0,
>      "persistentDequeuedBytes" : 0,
>      "consumerCount" : 0,
>      "unacknowledgedMessages" : 0,
>      "consumerCountWithCredit" : 0,
>      "totalDequeuedBytes" : 0,
>      "totalDequeuedMessages" : 0,
>      "totalEnqueuedMessages" : 0,
>      "persistentEnqueuedMessages" : 0,
>      "persistentEnqueuedBytes" : 0,
>      "persistentDequeuedMessages" : 0
>    }
> } ]
> curl -X PUT -u webadmin:webadmin -d '{"durable":true}'
> http://localhost:8080/t/queue/default/test_queue
> curl -X GET -u webadmin:webadmin
> http://localhost:8080/rest/queue/default/test_queue
>
> shows no change in the durable attribute.
>
> I am using qpid-broker-0.24 and proton 0.5.
>
> Thanks.
>


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


Mime
View raw message