You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by delphz <de...@capgemini.com> on 2007/10/19 13:48:37 UTC

Timeout and Failover on a queue

Hello,

I have some servers A1, A2, AN, ... that send messages on a queue on servers
B1 ans B2. I configured my A servers to connect with the following URI :
failover:(tcp://B1:61616,tcpB2:62626). But when activemq is stopped on both
B1 and B2, my servers A wait a long time before deciding that B1 and B2 are
down. So I test to add a timeout.

If I configure my A servers with : tcp://B1:61616?connectionTimeout=1000, I
have no problem. But if I configured with the following :
failover:(tcp://B1:61616?connectionTimeout=1000,tcp://B2:62626?connectionTimeout=1000),
it doesn't work. I tried lot of things :
- set connectionTimeout after the ) :
failover:(B1,B2)?connectionTimeout=1000
- set closeTimeout on my ConnectionFactory
- set wireFormat.maxInactivityDuration
- ...

I can't get it work.

Could you tell me how to configure it ?

Thanks !!

Delphine
-- 
View this message in context: http://www.nabble.com/Timeout-and-Failover-on-a-queue-tf4652630s2354.html#a13292887
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Timeout and Failover on a queue

Posted by Jason Rosenberg <jr...@shopzilla.com>.
I tried this out, it does appear to solve my problem.....Thanks!

Can we get it added to the 5.0 release?

Jason




hbruch wrote:
> 
> I had problems as well using failover with maxRetryAttempts and
> PooledConnections.
> Might there be a call missing in FailoverTransport to the
> transportListener indicating a finally failed connection?
> Find attached a patch I applied successfully to AMQ-4.1.1. (
> http://www.nabble.com/file/p14181174/FailoverTransport.java
> FailoverTransport.java )
> 
> Regards, 
> Holger
> 
> 
> James.Strachan wrote:
>> 
>> On 26/11/2007, Jason Rosenberg <jr...@shopzilla.com> wrote:
>>>
>>> I'm curious whether you've found a solution to this.  I've seen also
>>> that if
>>> you use the maxReconnectAttempts, and it fails to reconnect, then the
>>> connection cannot be reliably recovered.
>> 
>> If a connection fails to reconnect it must be discarded (along with
>> all of its associated resources). e.g. imagine a JDBC connection when
>> a database goes down - its of no real use any more
>> 
>> 
>>> I've tried it with the Jencks AMQPool for my connection pooling, as well
>>> as
>>> the standard ActiveMQ PooledConnections....
>>>
>>> And if you don't use the maxReconnectAttempts flag, then it retries
>>> forever,
>>> and hangs the client.
>>>
>>> So, I'd be interested to know if there's a way to have it recover
>>> cleanly on
>>> failure, but always return quickly to the client if all failover choices
>>> have failed....
>> 
>> Does switching to Spring's MessageListenerContainer stuff instead of
>> the Jencks pool help? Basically the pool must ditch the connections,
>> sessions & consumers if the connection fails.
>> -- 
>> James
>> -------
>> http://macstrac.blogspot.com/
>> 
>> Open Source Integration
>> http://open.iona.com
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Timeout-and-Failover-on-a-queue-tf4652630s2354.html#a14215834
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Timeout and Failover on a queue

Posted by hbruch <ho...@isb-ag.de>.
I had problems as well using failover with maxRetryAttempts and
PooledConnections.
Might there be a call missing in FailoverTransport to the transportListener
indicating a finally failed connection?
Find attached a patch I applied successfully to AMQ-4.1.1. (
http://www.nabble.com/file/p14181174/FailoverTransport.java
FailoverTransport.java )

Regards, 
Holger


James.Strachan wrote:
> 
> On 26/11/2007, Jason Rosenberg <jr...@shopzilla.com> wrote:
>>
>> I'm curious whether you've found a solution to this.  I've seen also that
>> if
>> you use the maxReconnectAttempts, and it fails to reconnect, then the
>> connection cannot be reliably recovered.
> 
> If a connection fails to reconnect it must be discarded (along with
> all of its associated resources). e.g. imagine a JDBC connection when
> a database goes down - its of no real use any more
> 
> 
>> I've tried it with the Jencks AMQPool for my connection pooling, as well
>> as
>> the standard ActiveMQ PooledConnections....
>>
>> And if you don't use the maxReconnectAttempts flag, then it retries
>> forever,
>> and hangs the client.
>>
>> So, I'd be interested to know if there's a way to have it recover cleanly
>> on
>> failure, but always return quickly to the client if all failover choices
>> have failed....
> 
> Does switching to Spring's MessageListenerContainer stuff instead of
> the Jencks pool help? Basically the pool must ditch the connections,
> sessions & consumers if the connection fails.
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://open.iona.com
> 
> 

-- 
View this message in context: http://www.nabble.com/Timeout-and-Failover-on-a-queue-tf4652630s2354.html#a14181174
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Test-case for problem with connections not refreshing when pooled with failover

Posted by Jason Rosenberg <jr...@shopzilla.com>.
All,

I've filed an issue, and posted a patch for 5.1-SNAPSHOT, for this issue
(I've taken hbuch's patch and put it into the 5.1 source)...

See AMQ-1575

Jason


-- 
View this message in context: http://www.nabble.com/Timeout-and-Failover-on-a-queue-tp13292887s2354p15328072.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Test-case for problem with connections not refreshing when pooled with failover

Posted by Jason Rosenberg <jr...@shopzilla.com>.
James,

I've created a test-case here, which demonstrates clearly the main problem,
with connections created with a pooledConnection don't recover quickly, when
a broker becomes available, when the failover transport is used, with a
maxReconnectAttempts setting.

Attached is a source tar file, which you can extract and build, with maven. 
It should build a web-app war file, which you can drop into tomcat (or
probably any j2ee container).  I have been using java 1.6 and maven 2.0.7,
although I don't know that those should be required.

The web-app implements a simple web-service (implemented with CXF).....

It exposes three methods:

/pingTcp
/pingFailover
/pintFailoverWithMaxAttempts

Which use respectively, these 3 broker uri's, respectively:

tcp://localhost:61616
failover:(tcp://localhost:61616,tcp://localhost:61626)?initialReconnectDelay=20&amp;maxReconnectDelay=500&amp;randomize=false
failover:(tcp://localhost:61616,tcp://localhost:61626)?initialReconnectDelay=20&amp;maxReconnectDelay=500&amp;randomize=false&amp;maxReconnectAttempts=2

All the ping method does is create a connection (without actually trying to
do anything with it).

Assuming you have the web-app deployed in tomcat, running on port 8080,
you'd hit the different methods as such:

http://localhost:8080/failover-test-web-1.0/FailoverTest/pingTcp
http://localhost:8080/failover-test-web-1.0/FailoverTest/pingFailover
http://localhost:8080/failover-test-web-1.0/FailoverTest/pingFailoverWithMaxAttempts


The connections are created using the activeMQ PooledConnectionFactory class
(see the spring template failover-test-ws.xml in the test-case source code). 
I originally was seeing the problem with the Jencks connection pooling, but
it appears to happen also using the activeMQ connection pooling too....

To reproduce the problem, do the following:

1. start with both activemq and tomcat down.
2. start tomcat with the webapp.
3. hit pingFailoverWithMaxAttempts link.
    it will return a connection error response.
4. Bring up the broker on localhost:61616
5. hit pingFailoverWithMaxAttempts link again, several times.
    it will continue returning the failed connection link.
6. Wait 3 minutes
7. hit pingFailoverWithMaxAttempts link again.
    it will finally return successfully, with a good connection

So, it takes 3 minutes for it to recognize a recovered broker.

Next, repeat the above, this time using the pingTcp link each time.  Notice
that it recovers immediately.

Also, when using the pingFailover method, it generally recovers immediately,
but has the downside that it hangs the response until the broker is
available (thus the desirability of the maxReconnectAttempts option).  There
has been suggestion in the forums to use a TransportListener, but it's not
obvious to me how one would do this, in a use-case similar to this example,
which uses a PooledConnectionFactory, etc.  (ideas would be welcome
there)....

Thanks for any help,

Jason


http://www.nabble.com/file/p14200217/failover_test_ws.source.tar
failover_test_ws.source.tar 




James.Strachan wrote:
> 
> On 27/11/2007, Jason Rosenberg <jr...@shopzilla.com> wrote:
>> James,
>>
>> In this case, I am creating a connection for the purspose of sending a
>> message (so not a message listener).  I am using the Spring JmsOperations
>> template, and just injecting the connectionFactory property  for the
>> jmsOperations object on initialization.
>>
>> The connectionFactory is org.jencks.amqpool.PooledConnectionFactory.  I
>> presume it's up to the factory code to properly dispose of the failed
>> connection's resources.  I also had the same result configuring it with
>> the
>> ActiveMQ factory, org.apache.activemq.pool.PooledConnectionFactory.
>>
>> In each case the pooled connection factories in turn use a
>> 'connectionFactory' object of
>> org.apache.activemq.ActiveMQConnectionFactory....
>>
>> What I've noticed is that this configuration works fine, if I use a
>> simple
>> TcpTransport.  That is, if the connection fails, the connection factory
>> seems to dispose of the resources and create a fresh one for the next
>> attempt, and so it recovers quickly when the broker recovers.
>>
>> Somehow, the FailoverTransport must fail in a different way, since the
>> connection factory doesn't detect that it needs to remove it and create a
>> new object on the next request.
>>
>> Finally, I've also seen that the FailoverTransport, if configured without
>> maxReconnectAttempts, doesn't shutdown cleanly, if there's no broker
>> present.  It hangs, or throws an exception.   I provide the
>> destroy-method="stop" on the pooled connection factory object.
>>
>> Thanks for any help,
> 
> Do you have a test case that demonstrates your issue?
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://open.iona.com
> 
> 

-- 
View this message in context: http://www.nabble.com/Timeout-and-Failover-on-a-queue-tf4652630s2354.html#a14200217
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Test-case for problem with connections not refreshing when pooled with failover

Posted by akhil <ak...@gmail.com>.
Hi Tim , 

I was having a question before but now everything seems to be fine. Yes this
question is no more applicable since it got resolved and which we updated on
the other post.

Thanks,
Akhil.



--
View this message in context: http://activemq.2283324.n4.nabble.com/Timeout-and-Failover-on-a-queue-tp2355377p4717176.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Test-case for problem with connections not refreshing when pooled with failover

Posted by Tim Bain <tb...@alumni.duke.edu>.
Akhil, are you asking a question, or just providing information to help
Jason (who's probably not going to see it, since his post is from 9 years
ago)?  Or is your question no longer applicable since you resolved the
issue in your other post?

Tim

On Sep 20, 2016 10:26 PM, "akhil" <ak...@gmail.com> wrote:

Hi Jason ,

I am late to the failover party and i am facing the same issue. Probably
mine is a different use case where i am intentionally putting down one of
the failover broker whether all the consumers and producers are getting
switching to the active broker remaining in the failover. I am using Broker
A and Broker B and sharing the common storage in which one of them is master
and slave at the same time . so i am starting with the broker a as master
which acquired db lock and slave is running but it is just like a back up
mode. My test started with Broker A as master -- 2 threads running in local
and hitting to the failover brokers and one thread is producer and the other
one is consumer. using this failover string as you stated above.

failover:(tcp://10.172.6.46:61616,tcp://10.172.107.57:
61616)?initialReconnectDelay=20&maxReconnectDelay=500&randomize=false&
maxReconnectAttempts=2

Producer and consumer working fine in this case. To add fun to the test , I
have made Broker A down and broker B became master and producer and consumer
ended up with this connection reset

23:48:10.500 [ActiveMQ Transport: tcp:///10.172.107.57:61616] DEBUG
o.a.a.transport.tcp.TcpTransport - Stopping transport
tcp:///10.172.107.57:61616
23:48:10.502 [ActiveMQ Transport: tcp:///10.172.107.57:61616] WARN
o.a.a.t.failover.FailoverTransport - Transport failed to
tcp://10.172.107.57:61616 , attempting to automatically reconnect due to:
java.net.SocketException: Connection reset
23:48:10.510 [ActiveMQ Transport: tcp:///10.172.107.57:61616] DEBUG
o.a.a.t.failover.FailoverTransport - Transport failed with the following
exception:
java.net.SocketException: Connection reset
        at java.net.SocketInputStream.read(SocketInputStream.java:209)
~[na:1.8.0_51]
        at java.net.SocketInputStream.read(SocketInputStream.java:141)
~[na:1.8.0_51]
        at
org.apache.activemq.transport.tcp.TcpBufferedInputStream.
fill(TcpBufferedInputStream.java:50)
~[activemq-all-5.1.0.jar:na]
        at
org.apache.activemq.transport.tcp.TcpBufferedInputStream.
read(TcpBufferedInputStream.java:58)
~[activemq-all-5.1.0.jar:na]
        at java.io.DataInputStream.readInt(DataInputStream.java:387)
~[na:1.8.0_51]

Before using your failover string i have used normal one with the randomize
flag , it was throwing up the inactivity monitor and never ever reconnecting
to the new master broker. This happens only in consumer thread and producer
gets ported successfully.

I really appreciate your help on this ..I have to have clues atleast what is
really going on this ..!! I am using activemq version of 5.11. and tried on
5.13 as well.

Thanks,
Akhil.



--
View this message in context: http://activemq.2283324.n4.
nabble.com/Timeout-and-Failover-on-a-queue-tp2355377p4716677.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Test-case for problem with connections not refreshing when pooled with failover

Posted by akhil <ak...@gmail.com>.
Hi Jason , 

I am late to the failover party and i am facing the same issue. Probably
mine is a different use case where i am intentionally putting down one of
the failover broker whether all the consumers and producers are getting
switching to the active broker remaining in the failover. I am using Broker
A and Broker B and sharing the common storage in which one of them is master
and slave at the same time . so i am starting with the broker a as master
which acquired db lock and slave is running but it is just like a back up
mode. My test started with Broker A as master -- 2 threads running in local
and hitting to the failover brokers and one thread is producer and the other
one is consumer. using this failover string as you stated above.

failover:(tcp://10.172.6.46:61616,tcp://10.172.107.57:61616)?initialReconnectDelay=20&maxReconnectDelay=500&randomize=false&maxReconnectAttempts=2

Producer and consumer working fine in this case. To add fun to the test , I
have made Broker A down and broker B became master and producer and consumer
ended up with this connection reset

23:48:10.500 [ActiveMQ Transport: tcp:///10.172.107.57:61616] DEBUG
o.a.a.transport.tcp.TcpTransport - Stopping transport
tcp:///10.172.107.57:61616
23:48:10.502 [ActiveMQ Transport: tcp:///10.172.107.57:61616] WARN 
o.a.a.t.failover.FailoverTransport - Transport failed to
tcp://10.172.107.57:61616 , attempting to automatically reconnect due to:
java.net.SocketException: Connection reset
23:48:10.510 [ActiveMQ Transport: tcp:///10.172.107.57:61616] DEBUG
o.a.a.t.failover.FailoverTransport - Transport failed with the following
exception:
java.net.SocketException: Connection reset
	at java.net.SocketInputStream.read(SocketInputStream.java:209)
~[na:1.8.0_51]
	at java.net.SocketInputStream.read(SocketInputStream.java:141)
~[na:1.8.0_51]
	at
org.apache.activemq.transport.tcp.TcpBufferedInputStream.fill(TcpBufferedInputStream.java:50)
~[activemq-all-5.1.0.jar:na]
	at
org.apache.activemq.transport.tcp.TcpBufferedInputStream.read(TcpBufferedInputStream.java:58)
~[activemq-all-5.1.0.jar:na]
	at java.io.DataInputStream.readInt(DataInputStream.java:387) ~[na:1.8.0_51]

Before using your failover string i have used normal one with the randomize
flag , it was throwing up the inactivity monitor and never ever reconnecting
to the new master broker. This happens only in consumer thread and producer
gets ported successfully.

I really appreciate your help on this ..I have to have clues atleast what is
really going on this ..!! I am using activemq version of 5.11. and tried on
5.13 as well.

Thanks,
Akhil.



--
View this message in context: http://activemq.2283324.n4.nabble.com/Timeout-and-Failover-on-a-queue-tp2355377p4716677.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Timeout and Failover on a queue

Posted by James Strachan <ja...@gmail.com>.
On 27/11/2007, Jason Rosenberg <jr...@shopzilla.com> wrote:
> James,
>
> In this case, I am creating a connection for the purspose of sending a
> message (so not a message listener).  I am using the Spring JmsOperations
> template, and just injecting the connectionFactory property  for the
> jmsOperations object on initialization.
>
> The connectionFactory is org.jencks.amqpool.PooledConnectionFactory.  I
> presume it's up to the factory code to properly dispose of the failed
> connection's resources.  I also had the same result configuring it with the
> ActiveMQ factory, org.apache.activemq.pool.PooledConnectionFactory.
>
> In each case the pooled connection factories in turn use a
> 'connectionFactory' object of
> org.apache.activemq.ActiveMQConnectionFactory....
>
> What I've noticed is that this configuration works fine, if I use a simple
> TcpTransport.  That is, if the connection fails, the connection factory
> seems to dispose of the resources and create a fresh one for the next
> attempt, and so it recovers quickly when the broker recovers.
>
> Somehow, the FailoverTransport must fail in a different way, since the
> connection factory doesn't detect that it needs to remove it and create a
> new object on the next request.
>
> Finally, I've also seen that the FailoverTransport, if configured without
> maxReconnectAttempts, doesn't shutdown cleanly, if there's no broker
> present.  It hangs, or throws an exception.   I provide the
> destroy-method="stop" on the pooled connection factory object.
>
> Thanks for any help,

Do you have a test case that demonstrates your issue?

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Re: Timeout and Failover on a queue

Posted by Jason Rosenberg <jr...@shopzilla.com>.
James,

In this case, I am creating a connection for the purspose of sending a
message (so not a message listener).  I am using the Spring JmsOperations
template, and just injecting the connectionFactory property  for the
jmsOperations object on initialization.

The connectionFactory is org.jencks.amqpool.PooledConnectionFactory.  I
presume it's up to the factory code to properly dispose of the failed
connection's resources.  I also had the same result configuring it with the
ActiveMQ factory, org.apache.activemq.pool.PooledConnectionFactory.

In each case the pooled connection factories in turn use a
'connectionFactory' object of
org.apache.activemq.ActiveMQConnectionFactory....

What I've noticed is that this configuration works fine, if I use a simple
TcpTransport.  That is, if the connection fails, the connection factory
seems to dispose of the resources and create a fresh one for the next
attempt, and so it recovers quickly when the broker recovers.

Somehow, the FailoverTransport must fail in a different way, since the
connection factory doesn't detect that it needs to remove it and create a
new object on the next request.

Finally, I've also seen that the FailoverTransport, if configured without
maxReconnectAttempts, doesn't shutdown cleanly, if there's no broker
present.  It hangs, or throws an exception.   I provide the
destroy-method="stop" on the pooled connection factory object.

Thanks for any help,

Jason



James.Strachan wrote:
> 
> On 26/11/2007, Jason Rosenberg <jr...@shopzilla.com> wrote:
>>
>> I'm curious whether you've found a solution to this.  I've seen also that
>> if
>> you use the maxReconnectAttempts, and it fails to reconnect, then the
>> connection cannot be reliably recovered.
> 
> If a connection fails to reconnect it must be discarded (along with
> all of its associated resources). e.g. imagine a JDBC connection when
> a database goes down - its of no real use any more
> 
> 
>> I've tried it with the Jencks AMQPool for my connection pooling, as well
>> as
>> the standard ActiveMQ PooledConnections....
>>
>> And if you don't use the maxReconnectAttempts flag, then it retries
>> forever,
>> and hangs the client.
>>
>> So, I'd be interested to know if there's a way to have it recover cleanly
>> on
>> failure, but always return quickly to the client if all failover choices
>> have failed....
> 
> Does switching to Spring's MessageListenerContainer stuff instead of
> the Jencks pool help? Basically the pool must ditch the connections,
> sessions & consumers if the connection fails.
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://open.iona.com
> 
> 

-- 
View this message in context: http://www.nabble.com/Timeout-and-Failover-on-a-queue-tf4652630s2354.html#a13969349
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Timeout and Failover on a queue

Posted by James Strachan <ja...@gmail.com>.
On 26/11/2007, Jason Rosenberg <jr...@shopzilla.com> wrote:
>
> I'm curious whether you've found a solution to this.  I've seen also that if
> you use the maxReconnectAttempts, and it fails to reconnect, then the
> connection cannot be reliably recovered.

If a connection fails to reconnect it must be discarded (along with
all of its associated resources). e.g. imagine a JDBC connection when
a database goes down - its of no real use any more


> I've tried it with the Jencks AMQPool for my connection pooling, as well as
> the standard ActiveMQ PooledConnections....
>
> And if you don't use the maxReconnectAttempts flag, then it retries forever,
> and hangs the client.
>
> So, I'd be interested to know if there's a way to have it recover cleanly on
> failure, but always return quickly to the client if all failover choices
> have failed....

Does switching to Spring's MessageListenerContainer stuff instead of
the Jencks pool help? Basically the pool must ditch the connections,
sessions & consumers if the connection fails.
-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Re: Timeout and Failover on a queue

Posted by Jason Rosenberg <jr...@shopzilla.com>.
I'm curious whether you've found a solution to this.  I've seen also that if
you use the maxReconnectAttempts, and it fails to reconnect, then the
connection cannot be reliably recovered.

I've tried it with the Jencks AMQPool for my connection pooling, as well as
the standard ActiveMQ PooledConnections....

And if you don't use the maxReconnectAttempts flag, then it retries forever,
and hangs the client.

So, I'd be interested to know if there's a way to have it recover cleanly on
failure, but always return quickly to the client if all failover choices
have failed....

Jason



delphz wrote:
> 
> I have a queueSession that is a singleton for my application on server A.
> This queueSession is set at startup. When I start up my application,
> activemq is up : my application can send messages. I stop activemq : the
> messages are dropped. But when I restart activemq, my application can't
> send messages. I tried to do a recover but it doesn't work.
> 
> 
> 
> Eduardo Corral wrote:
>> 
>> Yep, that's the normal behavior.
>> 
>> The A servers are probably failing to connect before the B brokers are 
>> started. With the parameters you set, and starting A servers before B 
>> brokers, it's bound to fail...
>> 
>> Try increasing  maxReconnectAttempts and maxReconnectDelay parameters, 
>> so there's enough time to B brokers to start before A servers give up 
>> trying.
>> 
>> BTW, which is the behaviour you're looking for? Infinite retries? 
>> Inmediate fail in case both B brokers are down?
>> 
>> Regards
>> Eduardo Corral
>> 
>> delphz escribió:
>>> OK, it was my mistake, i set a boolean to late...
>>>
>>> Now, I have the following configuration :
>>> failover://(tcp://B1:61616,tcp://B2:62626)?maxReconnectAttempts=1&maxReconnectDelay=100
>>>
>>> But when I restart my activemq server, my A servers cannot reconnect to
>>> it.
>>> When I send a message, I have : javax.jms.JMSException: Connection
>>> refused.
>>>
>>> Have you got an idea ?
>>>
>>>
>>> delphz wrote:
>>>   
>>>> I set the maxReconnectAttempts to 1 and it is trying to reconnect
>>>> endlessly. And it can't connect to the B servers, even if they are up.
>>>>
>>>>
>>>> Eduardo Corral wrote:
>>>>     
>>>>> Hi Delphine
>>>>>
>>>>> Have you checked the log files? Maybe the clients (A1, A2,...) do
>>>>> follow 
>>>>> the timeout parameter, but they are trying to reconnect endlessly...
>>>>>
>>>>> http://activemq.apache.org/failover-transport-reference.html
>>>>>
>>>>> With failover, you may also configure how long between retries and how 
>>>>> many of them.
>>>>>
>>>>> Best regards,
>>>>> Eduardo Corral
>>>>>
>>>>> delphz escribió:
>>>>>       
>>>>>> Hello,
>>>>>>
>>>>>> I have some servers A1, A2, AN, ... that send messages on a queue on
>>>>>> servers
>>>>>> B1 ans B2. I configured my A servers to connect with the following
>>>>>> URI :
>>>>>> failover:(tcp://B1:61616,tcpB2:62626). But when activemq is stopped
>>>>>> on
>>>>>> both
>>>>>> B1 and B2, my servers A wait a long time before deciding that B1 and
>>>>>> B2
>>>>>> are
>>>>>> down. So I test to add a timeout.
>>>>>>
>>>>>> If I configure my A servers with :
>>>>>> tcp://B1:61616?connectionTimeout=1000, I
>>>>>> have no problem. But if I configured with the following :
>>>>>> failover:(tcp://B1:61616?connectionTimeout=1000,tcp://B2:62626?connectionTimeout=1000),
>>>>>> it doesn't work. I tried lot of things :
>>>>>> - set connectionTimeout after the ) :
>>>>>> failover:(B1,B2)?connectionTimeout=1000
>>>>>> - set closeTimeout on my ConnectionFactory
>>>>>> - set wireFormat.maxInactivityDuration
>>>>>> - ...
>>>>>>
>>>>>> I can't get it work.
>>>>>>
>>>>>> Could you tell me how to configure it ?
>>>>>>
>>>>>> Thanks !!
>>>>>>
>>>>>> Delphine
>>>>>>   
>>>>>>         
>>>>>       
>>>>     
>>>
>>>   
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Timeout-and-Failover-on-a-queue-tf4652630s2354.html#a13958172
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Timeout and Failover on a queue

Posted by delphz <de...@capgemini.com>.
I have a queueSession that is a singleton for my application on server A.
This queueSession is set at startup. When I start up my application,
activemq is up : my application can send messages. I stop activemq : the
messages are dropped. But when I restart activemq, my application can't send
messages. I tried to do a recover but it doesn't work.



Eduardo Corral wrote:
> 
> Yep, that's the normal behavior.
> 
> The A servers are probably failing to connect before the B brokers are 
> started. With the parameters you set, and starting A servers before B 
> brokers, it's bound to fail...
> 
> Try increasing  maxReconnectAttempts and maxReconnectDelay parameters, 
> so there's enough time to B brokers to start before A servers give up 
> trying.
> 
> BTW, which is the behaviour you're looking for? Infinite retries? 
> Inmediate fail in case both B brokers are down?
> 
> Regards
> Eduardo Corral
> 
> delphz escribió:
>> OK, it was my mistake, i set a boolean to late...
>>
>> Now, I have the following configuration :
>> failover://(tcp://B1:61616,tcp://B2:62626)?maxReconnectAttempts=1&maxReconnectDelay=100
>>
>> But when I restart my activemq server, my A servers cannot reconnect to
>> it.
>> When I send a message, I have : javax.jms.JMSException: Connection
>> refused.
>>
>> Have you got an idea ?
>>
>>
>> delphz wrote:
>>   
>>> I set the maxReconnectAttempts to 1 and it is trying to reconnect
>>> endlessly. And it can't connect to the B servers, even if they are up.
>>>
>>>
>>> Eduardo Corral wrote:
>>>     
>>>> Hi Delphine
>>>>
>>>> Have you checked the log files? Maybe the clients (A1, A2,...) do
>>>> follow 
>>>> the timeout parameter, but they are trying to reconnect endlessly...
>>>>
>>>> http://activemq.apache.org/failover-transport-reference.html
>>>>
>>>> With failover, you may also configure how long between retries and how 
>>>> many of them.
>>>>
>>>> Best regards,
>>>> Eduardo Corral
>>>>
>>>> delphz escribió:
>>>>       
>>>>> Hello,
>>>>>
>>>>> I have some servers A1, A2, AN, ... that send messages on a queue on
>>>>> servers
>>>>> B1 ans B2. I configured my A servers to connect with the following URI
>>>>> :
>>>>> failover:(tcp://B1:61616,tcpB2:62626). But when activemq is stopped on
>>>>> both
>>>>> B1 and B2, my servers A wait a long time before deciding that B1 and
>>>>> B2
>>>>> are
>>>>> down. So I test to add a timeout.
>>>>>
>>>>> If I configure my A servers with :
>>>>> tcp://B1:61616?connectionTimeout=1000, I
>>>>> have no problem. But if I configured with the following :
>>>>> failover:(tcp://B1:61616?connectionTimeout=1000,tcp://B2:62626?connectionTimeout=1000),
>>>>> it doesn't work. I tried lot of things :
>>>>> - set connectionTimeout after the ) :
>>>>> failover:(B1,B2)?connectionTimeout=1000
>>>>> - set closeTimeout on my ConnectionFactory
>>>>> - set wireFormat.maxInactivityDuration
>>>>> - ...
>>>>>
>>>>> I can't get it work.
>>>>>
>>>>> Could you tell me how to configure it ?
>>>>>
>>>>> Thanks !!
>>>>>
>>>>> Delphine
>>>>>   
>>>>>         
>>>>       
>>>     
>>
>>   
> 
> 

-- 
View this message in context: http://www.nabble.com/Timeout-and-Failover-on-a-queue-tf4652630s2354.html#a13294714
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Timeout and Failover on a queue

Posted by Eduardo Corral <ec...@tid.es>.
Yep, that's the normal behavior.

The A servers are probably failing to connect before the B brokers are 
started. With the parameters you set, and starting A servers before B 
brokers, it's bound to fail...

Try increasing  maxReconnectAttempts and maxReconnectDelay parameters, 
so there's enough time to B brokers to start before A servers give up 
trying.

BTW, which is the behaviour you're looking for? Infinite retries? 
Inmediate fail in case both B brokers are down?

Regards
Eduardo Corral

delphz escribió:
> OK, it was my mistake, i set a boolean to late...
>
> Now, I have the following configuration :
> failover://(tcp://B1:61616,tcp://B2:62626)?maxReconnectAttempts=1&maxReconnectDelay=100
>
> But when I restart my activemq server, my A servers cannot reconnect to it.
> When I send a message, I have : javax.jms.JMSException: Connection refused.
>
> Have you got an idea ?
>
>
> delphz wrote:
>   
>> I set the maxReconnectAttempts to 1 and it is trying to reconnect
>> endlessly. And it can't connect to the B servers, even if they are up.
>>
>>
>> Eduardo Corral wrote:
>>     
>>> Hi Delphine
>>>
>>> Have you checked the log files? Maybe the clients (A1, A2,...) do follow 
>>> the timeout parameter, but they are trying to reconnect endlessly...
>>>
>>> http://activemq.apache.org/failover-transport-reference.html
>>>
>>> With failover, you may also configure how long between retries and how 
>>> many of them.
>>>
>>> Best regards,
>>> Eduardo Corral
>>>
>>> delphz escribió:
>>>       
>>>> Hello,
>>>>
>>>> I have some servers A1, A2, AN, ... that send messages on a queue on
>>>> servers
>>>> B1 ans B2. I configured my A servers to connect with the following URI :
>>>> failover:(tcp://B1:61616,tcpB2:62626). But when activemq is stopped on
>>>> both
>>>> B1 and B2, my servers A wait a long time before deciding that B1 and B2
>>>> are
>>>> down. So I test to add a timeout.
>>>>
>>>> If I configure my A servers with :
>>>> tcp://B1:61616?connectionTimeout=1000, I
>>>> have no problem. But if I configured with the following :
>>>> failover:(tcp://B1:61616?connectionTimeout=1000,tcp://B2:62626?connectionTimeout=1000),
>>>> it doesn't work. I tried lot of things :
>>>> - set connectionTimeout after the ) :
>>>> failover:(B1,B2)?connectionTimeout=1000
>>>> - set closeTimeout on my ConnectionFactory
>>>> - set wireFormat.maxInactivityDuration
>>>> - ...
>>>>
>>>> I can't get it work.
>>>>
>>>> Could you tell me how to configure it ?
>>>>
>>>> Thanks !!
>>>>
>>>> Delphine
>>>>   
>>>>         
>>>       
>>     
>
>   

Re: Timeout and Failover on a queue

Posted by delphz <de...@capgemini.com>.
OK, it was my mistake, i set a boolean to late...

Now, I have the following configuration :
failover://(tcp://B1:61616,tcp://B2:62626)?maxReconnectAttempts=1&maxReconnectDelay=100

But when I restart my activemq server, my A servers cannot reconnect to it.
When I send a message, I have : javax.jms.JMSException: Connection refused.

Have you got an idea ?


delphz wrote:
> 
> I set the maxReconnectAttempts to 1 and it is trying to reconnect
> endlessly. And it can't connect to the B servers, even if they are up.
> 
> 
> Eduardo Corral wrote:
>> 
>> Hi Delphine
>> 
>> Have you checked the log files? Maybe the clients (A1, A2,...) do follow 
>> the timeout parameter, but they are trying to reconnect endlessly...
>> 
>> http://activemq.apache.org/failover-transport-reference.html
>> 
>> With failover, you may also configure how long between retries and how 
>> many of them.
>> 
>> Best regards,
>> Eduardo Corral
>> 
>> delphz escribió:
>>> Hello,
>>>
>>> I have some servers A1, A2, AN, ... that send messages on a queue on
>>> servers
>>> B1 ans B2. I configured my A servers to connect with the following URI :
>>> failover:(tcp://B1:61616,tcpB2:62626). But when activemq is stopped on
>>> both
>>> B1 and B2, my servers A wait a long time before deciding that B1 and B2
>>> are
>>> down. So I test to add a timeout.
>>>
>>> If I configure my A servers with :
>>> tcp://B1:61616?connectionTimeout=1000, I
>>> have no problem. But if I configured with the following :
>>> failover:(tcp://B1:61616?connectionTimeout=1000,tcp://B2:62626?connectionTimeout=1000),
>>> it doesn't work. I tried lot of things :
>>> - set connectionTimeout after the ) :
>>> failover:(B1,B2)?connectionTimeout=1000
>>> - set closeTimeout on my ConnectionFactory
>>> - set wireFormat.maxInactivityDuration
>>> - ...
>>>
>>> I can't get it work.
>>>
>>> Could you tell me how to configure it ?
>>>
>>> Thanks !!
>>>
>>> Delphine
>>>   
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Timeout-and-Failover-on-a-queue-tf4652630s2354.html#a13293740
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Timeout and Failover on a queue

Posted by delphz <de...@capgemini.com>.
I set the maxReconnectAttempts to 1 and it is trying to reconnect endlessly.
And it can't connect to the B servers, even if they are up.


Eduardo Corral wrote:
> 
> Hi Delphine
> 
> Have you checked the log files? Maybe the clients (A1, A2,...) do follow 
> the timeout parameter, but they are trying to reconnect endlessly...
> 
> http://activemq.apache.org/failover-transport-reference.html
> 
> With failover, you may also configure how long between retries and how 
> many of them.
> 
> Best regards,
> Eduardo Corral
> 
> delphz escribió:
>> Hello,
>>
>> I have some servers A1, A2, AN, ... that send messages on a queue on
>> servers
>> B1 ans B2. I configured my A servers to connect with the following URI :
>> failover:(tcp://B1:61616,tcpB2:62626). But when activemq is stopped on
>> both
>> B1 and B2, my servers A wait a long time before deciding that B1 and B2
>> are
>> down. So I test to add a timeout.
>>
>> If I configure my A servers with : tcp://B1:61616?connectionTimeout=1000,
>> I
>> have no problem. But if I configured with the following :
>> failover:(tcp://B1:61616?connectionTimeout=1000,tcp://B2:62626?connectionTimeout=1000),
>> it doesn't work. I tried lot of things :
>> - set connectionTimeout after the ) :
>> failover:(B1,B2)?connectionTimeout=1000
>> - set closeTimeout on my ConnectionFactory
>> - set wireFormat.maxInactivityDuration
>> - ...
>>
>> I can't get it work.
>>
>> Could you tell me how to configure it ?
>>
>> Thanks !!
>>
>> Delphine
>>   
> 
> 

-- 
View this message in context: http://www.nabble.com/Timeout-and-Failover-on-a-queue-tf4652630s2354.html#a13293655
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Timeout and Failover on a queue

Posted by Eduardo Corral <ec...@tid.es>.
Hi Delphine

Have you checked the log files? Maybe the clients (A1, A2,...) do follow 
the timeout parameter, but they are trying to reconnect endlessly...

http://activemq.apache.org/failover-transport-reference.html

With failover, you may also configure how long between retries and how 
many of them.

Best regards,
Eduardo Corral

delphz escribió:
> Hello,
>
> I have some servers A1, A2, AN, ... that send messages on a queue on servers
> B1 ans B2. I configured my A servers to connect with the following URI :
> failover:(tcp://B1:61616,tcpB2:62626). But when activemq is stopped on both
> B1 and B2, my servers A wait a long time before deciding that B1 and B2 are
> down. So I test to add a timeout.
>
> If I configure my A servers with : tcp://B1:61616?connectionTimeout=1000, I
> have no problem. But if I configured with the following :
> failover:(tcp://B1:61616?connectionTimeout=1000,tcp://B2:62626?connectionTimeout=1000),
> it doesn't work. I tried lot of things :
> - set connectionTimeout after the ) :
> failover:(B1,B2)?connectionTimeout=1000
> - set closeTimeout on my ConnectionFactory
> - set wireFormat.maxInactivityDuration
> - ...
>
> I can't get it work.
>
> Could you tell me how to configure it ?
>
> Thanks !!
>
> Delphine
>