You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by mkrueger <m....@topdesk.com> on 2016/07/18 12:34:06 UTC

Consumer does not reconnect

Hi everybody,

we are currently busy building a MOM based on ActiveMQ.
We have a Master / Slave configuration on the broker side and use a
connection pool (PooledConnectionFactory) for the clients.
If the connection between broker and client dies (e.g. forced shutdown of
master) the failover kicks in.
It looks to us like the failover is not working in combination with a
connection pool since the consumer does not reconnect in any way. 
Did somebody already experience a similar behaviour and has a hint?

Thanks already in advance.



--
View this message in context: http://activemq.2283324.n4.nabble.com/Consumer-does-not-reconnect-tp4714039.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Consumer does not reconnect

Posted by "crishel.yumul" <cr...@toro.io>.
Tim Bain wrote
> Can you please explain what aspects of your answer are expected to solve
> the specific problem that Martin is describing in this thread, and why
> they're expected to solve it?  At first glance, I don't see why using
> synchronous TCP closes would influence failover of connections managed by
> a
> connection pool, so I'd like to better understand what you're suggesting.
> 
> Tim
> 
> On Jul 21, 2016 3:01 AM, "crishel.yumul" &lt;

> crishel.yumul@

> &gt; wrote:
> 
>> Hi,
>> configure your broker URL with this
>> failover:tcp://
> <master>
> :
> <port>
> ,tcp://
> <slave>
> :
> <port>
> ?closeAsync=false
>>
>> Hope it helps!
>>
>> Regards,
>> Crishel Yumul
>> DevOps
>> TORO Limited
>>
>>
>>
>> --
>> View this message in context:
>> http://activemq.2283324.n4.nabble.com/Consumer-does-not-reconnect-tp4714039p4714219.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>

"Failover" to specify you're using master/slave setup
"TCP" usage is for the clients connecting to a remote broker. You can use
different transport reference depends on your broker setup, hence,
http://activemq.apache.org/uri-protocols.html

Since I'm using TCP protocol ref, closeAsync is one of the many config
options for TCP, remember every protocol defines its own config option.
closeAsync by default is true, set it false so that alive brokers can send
signal before socket connection closed.




--
View this message in context: http://activemq.2283324.n4.nabble.com/Consumer-does-not-reconnect-tp4714039p4714281.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Consumer does not reconnect

Posted by Tim Bain <tb...@alumni.duke.edu>.
Can you please explain what aspects of your answer are expected to solve
the specific problem that Martin is describing in this thread, and why
they're expected to solve it?  At first glance, I don't see why using
synchronous TCP closes would influence failover of connections managed by a
connection pool, so I'd like to better understand what you're suggesting.

Tim

On Jul 21, 2016 3:01 AM, "crishel.yumul" <cr...@toro.io> wrote:

> Hi,
> configure your broker URL with this
> failover:tcp://<master>:<port>,tcp://<slave>:<port>?closeAsync=false
>
> Hope it helps!
>
> Regards,
> Crishel Yumul
> DevOps
> TORO Limited
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Consumer-does-not-reconnect-tp4714039p4714219.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Re: Consumer does not reconnect

Posted by "crishel.yumul" <cr...@toro.io>.
Hi,
configure your broker URL with this
failover:tcp://<master>:<port>,tcp://<slave>:<port>?closeAsync=false

Hope it helps!

Regards,
Crishel Yumul
DevOps
TORO Limited



--
View this message in context: http://activemq.2283324.n4.nabble.com/Consumer-does-not-reconnect-tp4714039p4714219.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Consumer does not reconnect

Posted by Christian Schneider <ch...@die-schneider.net>.
Can you share your code in form of a small example?

It depends a bit how you do the consumer. In case you use an event based 
consumer you might need to set an exception listener.
http://docs.oracle.com/javaee/6/api/javax/jms/Connection.html#setExceptionListener(javax.jms.ExceptionListener)

You can then close the consumer and connection and recreate it.

Christian


On 19.07.2016 09:24, mkrueger wrote:
> Hi Christian,
>
> thanks for the answer. We tried that already with different values from 1
> sec to 30 sec. Did not work out.
> Also leaving the PooledConnectionFactory out did not help.
> And all of this only occurs in the consumer case. The producer pics up the
> failover nicely. Anything else that might keep the broken connection in the
> consumer rather than replacing it with a new (working) one?
>
> Regards,
> Martin
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Consumer-does-not-reconnect-tp4714039p4714084.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com


Re: Consumer does not reconnect

Posted by mkrueger <m....@topdesk.com>.
Hi Christian,

thanks for the answer. We tried that already with different values from 1
sec to 30 sec. Did not work out. 
Also leaving the PooledConnectionFactory out did not help. 
And all of this only occurs in the consumer case. The producer pics up the
failover nicely. Anything else that might keep the broken connection in the
consumer rather than replacing it with a new (working) one?

Regards,
Martin



--
View this message in context: http://activemq.2283324.n4.nabble.com/Consumer-does-not-reconnect-tp4714039p4714084.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Consumer does not reconnect

Posted by Christian Schneider <ch...@die-schneider.net>.
Yes. You might need to set the expiryTimeout on the pool.
With expiryTimeout=0 broken connections might not be discarded in some 
cases.

Try to set it to 30 seconds for a start.

Christian


On 18.07.2016 14:34, mkrueger wrote:
> Hi everybody,
>
> we are currently busy building a MOM based on ActiveMQ.
> We have a Master / Slave configuration on the broker side and use a
> connection pool (PooledConnectionFactory) for the clients.
> If the connection between broker and client dies (e.g. forced shutdown of
> master) the failover kicks in.
> It looks to us like the failover is not working in combination with a
> connection pool since the consumer does not reconnect in any way.
> Did somebody already experience a similar behaviour and has a hint?
>
> Thanks already in advance.
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Consumer-does-not-reconnect-tp4714039.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com