You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Andrew Grissom <an...@outlook.com> on 2013/10/17 23:19:41 UTC

Flow Control for JMS Durable Subscribers

I have a Java client using the JMS interfaces that connects to the qpid C++ broker to receive updates on a topic.   I need to make this subscription durable, which is pretty easy using the straight JMS calls.  However, the problem I have is how do I handle clients that do not cleanly remove their subscriptions or do not connect for an extended period of time?  I can prevent this somewhat by using the TTL values but is there a way to switch the broker from rejecting messages when a queue is full to using the ring policy?  Is there a better way to handle this situation? 		 	   		  

Re: Flow Control for JMS Durable Subscribers

Posted by Pavel Moravec <pm...@redhat.com>.
What version of qpid Java client do you use? I tried 0.24 and it created the queue with proper options:

$ ./run_example.sh org.apache.qpid.example.Drain -f -c 1 "amq.fanout; {link:{durable:True, name:'my-subscription', x-declare:{auto-delete:True, arguments:{'qpid.auto_delete_timeout':10}}}}" &
$ qpid-stat -q
Queues
  queue                                     dur  autoDel  excl  msg   msgIn  msgOut  bytes  bytesIn  bytesOut  cons  bind
  =========================================================================================================================
  204f1f75-93a4-4cdf-a78d-2bc0d0c62ff5:0.0       Y        Y        0     0      0       0      0        0         1     2
  my-subscription                           Y    Y        Y        0     0      0       0      0        0         1     2
$  qpid-config queues my-subscription
Queue Name       Attributes
========================================
my-subscription  --durable --replicate=all auto-del excl --argument qpid.ha-uuid=True --argument qpid.auto_delete_timeout=10 --argument no-local=False
$


Kind regards,
Pavel


----- Original Message -----
> From: "Gordon Sim" <gs...@redhat.com>
> To: users@qpid.apache.org
> Sent: Monday, October 21, 2013 10:58:03 AM
> Subject: Re: Flow Control for JMS Durable Subscribers
> 
> On 10/20/2013 10:19 PM, Andrew Grissom wrote:
> > I took a look at the examples and that works just like I wanted, I'm not
> > sure how my googling missed that page.
> > I also saw that I can have the queue be auto-deleted after a certain time
> > period, but it does not seem to work when I make the queues durable. For
> > example:
> > my-topic; {link:{durable:True, name:'my-subscription',
> > x-declare:{auto-delete:True, arguments:{'qpid.auto_delete_timeout':30}}}}
> >
> > In this case I see durable in qpid-config.  If I remove durable:True, I see
> > auto-delete.  Is this the expected behavior and if it is, is there a way
> > to have the broker automatically delete a durable subscription queue after
> > a certain period of time?
> 
> That is certainly not the behaviour I would expect. Using the same
> address with the c++ client for example, the queue created is both
> durable and auto-deleted (with delay as configured).
> 
> Could you create a bug report for that:
> https://issues.apache.org/jira/browse/QPID
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
> 
> 

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


Re: Flow Control for JMS Durable Subscribers

Posted by Gordon Sim <gs...@redhat.com>.
On 10/20/2013 10:19 PM, Andrew Grissom wrote:
> I took a look at the examples and that works just like I wanted, I'm not sure how my googling missed that page.
> I also saw that I can have the queue be auto-deleted after a certain time period, but it does not seem to work when I make the queues durable. For example:
> my-topic; {link:{durable:True, name:'my-subscription', x-declare:{auto-delete:True, arguments:{'qpid.auto_delete_timeout':30}}}}
>
> In this case I see durable in qpid-config.  If I remove durable:True, I see auto-delete.  Is this the expected behavior and if it is, is there a way to have the broker automatically delete a durable subscription queue after a certain period of time?

That is certainly not the behaviour I would expect. Using the same 
address with the c++ client for example, the queue created is both 
durable and auto-deleted (with delay as configured).

Could you create a bug report for that: 
https://issues.apache.org/jira/browse/QPID

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


RE: Flow Control for JMS Durable Subscribers

Posted by Andrew Grissom <an...@outlook.com>.
I took a look at the examples and that works just like I wanted, I'm not sure how my googling missed that page.  
I also saw that I can have the queue be auto-deleted after a certain time period, but it does not seem to work when I make the queues durable. For example:
my-topic; {link:{durable:True, name:'my-subscription', x-declare:{auto-delete:True, arguments:{'qpid.auto_delete_timeout':30}}}}

In this case I see durable in qpid-config.  If I remove durable:True, I see auto-delete.  Is this the expected behavior and if it is, is there a way to have the broker automatically delete a durable subscription queue after a certain period of time?
Thanks
> Date: Fri, 18 Oct 2013 07:12:30 -0400
> From: pmoravec@redhat.com
> To: users@qpid.apache.org
> Subject: Re: Flow Control for JMS Durable Subscribers
> 
> Hi Andrew,
> I recommend reading https://cwiki.apache.org/confluence/display/qpid/Addressing+Examples where one example covers your requirement. When declaring the topic, use "{link:{x-declare:{arguments:{'qpid.max_count':500,'qpid.policy_type':'ring'}}}}" in its address string to create auxiliary queue of ring policy and of maximal message depth 500.
> 
> Kind regards,
> Pavel
> 
> 
> ----- Original Message -----
> > From: "Andrew Grissom" <an...@outlook.com>
> > To: users@qpid.apache.org
> > Sent: Thursday, October 17, 2013 11:19:41 PM
> > Subject: Flow Control for JMS Durable Subscribers
> > 
> > I have a Java client using the JMS interfaces that connects to the qpid C++
> > broker to receive updates on a topic.   I need to make this subscription
> > durable, which is pretty easy using the straight JMS calls.  However, the
> > problem I have is how do I handle clients that do not cleanly remove their
> > subscriptions or do not connect for an extended period of time?  I can
> > prevent this somewhat by using the TTL values but is there a way to switch
> > the broker from rejecting messages when a queue is full to using the ring
> > policy?  Is there a better way to handle this situation?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
> 
 		 	   		  

Re: Flow Control for JMS Durable Subscribers

Posted by Pavel Moravec <pm...@redhat.com>.
Hi Andrew,
I recommend reading https://cwiki.apache.org/confluence/display/qpid/Addressing+Examples where one example covers your requirement. When declaring the topic, use "{link:{x-declare:{arguments:{'qpid.max_count':500,'qpid.policy_type':'ring'}}}}" in its address string to create auxiliary queue of ring policy and of maximal message depth 500.

Kind regards,
Pavel


----- Original Message -----
> From: "Andrew Grissom" <an...@outlook.com>
> To: users@qpid.apache.org
> Sent: Thursday, October 17, 2013 11:19:41 PM
> Subject: Flow Control for JMS Durable Subscribers
> 
> I have a Java client using the JMS interfaces that connects to the qpid C++
> broker to receive updates on a topic.   I need to make this subscription
> durable, which is pretty easy using the straight JMS calls.  However, the
> problem I have is how do I handle clients that do not cleanly remove their
> subscriptions or do not connect for an extended period of time?  I can
> prevent this somewhat by using the TTL values but is there a way to switch
> the broker from rejecting messages when a queue is full to using the ring
> policy?  Is there a better way to handle this situation?

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


Re: Flow Control for JMS Durable Subscribers

Posted by Gordon Sim <gs...@redhat.com>.
On 10/17/2013 10:19 PM, Andrew Grissom wrote:
> I have a Java client using the JMS interfaces that connects to the
> qpid C++ broker to receive updates on a topic.   I need to make this
> subscription durable, which is pretty easy using the straight JMS
> calls.  However, the problem I have is how do I handle clients that
> do not cleanly remove their subscriptions or do not connect for an
> extended period of time?  I can prevent this somewhat by using the
> TTL values but is there a way to switch the broker from rejecting
> messages when a queue is full to using the ring policy?  Is there a
> better way to handle this situation?

Just fyi, as of 0.24 there is also a 'self-destruct' policy which if 
used in place of ring here will result in the subscription queue being 
deleted when it hits a limit, which will in turn kill the subscription. 
I.e. you can handle slow consumers by throttling/restricting producers, 
dropping messages or killing those slow consumers.

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