You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Aleš Trček <Al...@halcom.si> on 2013/08/20 18:58:01 UTC
JMS client reconnect to qpidc
Hi all,
I tested a situation where I have JMS consumers (and producers for that matter) attached to some queues on qpidc-0.22 broker and then I stop the broker and start it again (with persistence module). The connection is not reestablished, and subsequent calls to MessageConsumer.receive() all throw IllegalStateException. When I tried to do connetion.start() (in the catch block), I also get IllegalStateException (in debug I can see that the connection is closed). qpid-stat -u shows no connections.
I would like to be able to (automatically) reconnect in such case, and continue to use the same MessageConsumer object(s) if possible. Are there any special options I have to use (on broker or client side) or how should I handle such situation?
I am using AMQP-0.10 and java client libs 0.25.
Regards,
Ales
RE: JMS client reconnect to qpidc
Posted by Aleš Trček <Al...@halcom.si>.
So simple, huh...
For the documentation purposes, something like this is enough (singlebroker is default option):
amqp://guest:guest@your_broker/test?maxprefetch='1'&brokerlist='tcp://192.168.1.100:5672?retries='10'&connectdelay='6000''
Regards,
Ales
-----Original Message-----
From: Gordon Sim [mailto:gsim@redhat.com]
Sent: Tuesday, August 20, 2013 7:52 PM
To: users@qpid.apache.org
Subject: Re: JMS client reconnect to qpidc
On 08/20/2013 05:58 PM, Aleš Trček wrote:
> Hi all,
>
> I tested a situation where I have JMS consumers (and producers for that matter) attached to some queues on qpidc-0.22 broker and then I stop the broker and start it again (with persistence module). The connection is not reestablished, and subsequent calls to MessageConsumer.receive() all throw IllegalStateException. When I tried to do connetion.start() (in the catch block), I also get IllegalStateException (in debug I can see that the connection is closed). qpid-stat -u shows no connections.
> I would like to be able to (automatically) reconnect in such case, and continue to use the same MessageConsumer object(s) if possible. Are there any special options I have to use (on broker or client side) or how should I handle such situation?
>
> I am using AMQP-0.10 and java client libs 0.25.
You can configure the client to try to reconnect using the connection "url" options:
http://qpid.apache.org/releases/qpid-0.22/programming/book/QpidJNDI.html#section-jms-connection-url
The third example in section 3.4 would be closest to what you want to do. You could edit the retries and take out the second broker from the broker list. (And possibly change from roundrobin to singlebroker for the failover option?)
---------------------------------------------------------------------
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: JMS client reconnect to qpidc
Posted by Gordon Sim <gs...@redhat.com>.
On 08/20/2013 05:58 PM, Aleš Trček wrote:
> Hi all,
>
> I tested a situation where I have JMS consumers (and producers for that matter) attached to some queues on qpidc-0.22 broker and then I stop the broker and start it again (with persistence module). The connection is not reestablished, and subsequent calls to MessageConsumer.receive() all throw IllegalStateException. When I tried to do connetion.start() (in the catch block), I also get IllegalStateException (in debug I can see that the connection is closed). qpid-stat -u shows no connections.
> I would like to be able to (automatically) reconnect in such case, and continue to use the same MessageConsumer object(s) if possible. Are there any special options I have to use (on broker or client side) or how should I handle such situation?
>
> I am using AMQP-0.10 and java client libs 0.25.
You can configure the client to try to reconnect using the connection
"url" options:
http://qpid.apache.org/releases/qpid-0.22/programming/book/QpidJNDI.html#section-jms-connection-url
The third example in section 3.4 would be closest to what you want to
do. You could edit the retries and take out the second broker from the
broker list. (And possibly change from roundrobin to singlebroker for
the failover option?)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org