You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by jburford <jb...@solekai.com> on 2014/06/11 01:24:24 UTC

unregistering JMS consumers

Hi.

I have a network of activemq brokers and for scale & HA we have competing
consumers on each node on the same queues.  When one node has a failure, I
want to unregister JMS consumers so that messages do not get sent to the
node by activemq.  When I call CamelContext.stop and/or
CamelContext.stopRoute on all the routes, I still see the consumer count > 0
on the queues.  Because of this, messages still are sent to the node but
since the Camel routes are stopped, my code does not process the messages
and they just pile up and get stale.

Is there any way to completely unregister the JMS consumers so they don't
show up on the activemq admin page in the consumer count on the queue?  This
is the only way to push the load to the other nodes in the network of
brokers when one of them goes down.

Any help on this would be much appreciated!



--
View this message in context: http://camel.465427.n5.nabble.com/unregistering-JMS-consumers-tp5752130.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: unregistering JMS consumers

Posted by jburford <jb...@solekai.com>.
Would anyone have any ideas about why I would get this Exception when
restarting (calling start after having called stop earlier) the
PooledConnectionFactory:


javax.jms.JMSException: Error while attempting to add new Connection to the
pool
	at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)
	at
org.apache.activemq.pool.PooledConnectionFactory.createConnection(PooledConnectionFactory.java:216)
	at
org.apache.activemq.pool.PooledConnectionFactory.createConnection(PooledConnectionFactory.java:195)
	at
org.apache.activemq.pool.PooledConnectionFactory.start(PooledConnectionFactory.java:260)
Caused by: java.lang.IllegalStateException: Pool not open
	at
org.apache.commons.pool.BaseKeyedObjectPool.assertOpen(BaseKeyedObjectPool.java:160)
	at
org.apache.commons.pool.impl.GenericKeyedObjectPool.addObject(GenericKeyedObjectPool.java:1744)
	at
org.apache.activemq.pool.PooledConnectionFactory.createConnection(PooledConnectionFactory.java:214)


I will try using the PooledConnectionFactory if I have to (since it solves
the lingering consumer problem when I call stop), but it seems to have
issues when I call start when I want to bring my application back up.

Cheers!



--
View this message in context: http://camel.465427.n5.nabble.com/unregistering-JMS-consumers-tp5752130p5752138.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: unregistering JMS consumers

Posted by jburford <jb...@solekai.com>.
Hi Claus.

So this does in fact work with a pooled JMS connection.  However, we are
using a org.springframework.jms.connection.CachingConnectionFactory.  Is it
possible to unregister the consumers when using a caching connection
factory?

Thanks for your help!



--
View this message in context: http://camel.465427.n5.nabble.com/unregistering-JMS-consumers-tp5752130p5752137.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: unregistering JMS consumers

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Are you using any connection pool for JMS, if so remember to stop that too.

On Wed, Jun 11, 2014 at 1:24 AM, jburford <jb...@solekai.com> wrote:
> Hi.
>
> I have a network of activemq brokers and for scale & HA we have competing
> consumers on each node on the same queues.  When one node has a failure, I
> want to unregister JMS consumers so that messages do not get sent to the
> node by activemq.  When I call CamelContext.stop and/or
> CamelContext.stopRoute on all the routes, I still see the consumer count > 0
> on the queues.  Because of this, messages still are sent to the node but
> since the Camel routes are stopped, my code does not process the messages
> and they just pile up and get stale.
>
> Is there any way to completely unregister the JMS consumers so they don't
> show up on the activemq admin page in the consumer count on the queue?  This
> is the only way to push the load to the other nodes in the network of
> brokers when one of them goes down.
>
> Any help on this would be much appreciated!
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/unregistering-JMS-consumers-tp5752130.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/