Hello,

In the logs bellow it's definitely retrying, as it says "currentAttempts=11"

During my (limited) tests, adding the 2nd/backup broker works, but with spring if you are not using a pool and disabling the connection caching at spring level, it will indefinitely try to connect to the backup, so it's using CPU cycles for nothing.

I still don't understand why the client library is not using the backup server that is advertised by the master (the logs show that the client knows about it).

Is that a bug? Normal behavior? Am I overlooking something?

Le 3/12/19 à 21:57, Justin Bertram a écrit :
The default value for "reconnectAttempts" is 0 so I would recommend setting
it higher to have better success of actually reconnecting, e.g.:

   (tcp://dl02130v.example.com:61616)?ha=true&reconnectAttempts=25

Also, I think it would also be smart to add the backup's info to the URL as
well in case the master is down when a connection is initiated, e.g.:

   (tcp://dl02130v.example.com:61616,tcp://dl02131v.example.com:61616
)?ha=true&reconnectAttempts=25


Justin


On Tue, Dec 3, 2019 at 8:45 AM Laurent Bigonville <[email protected]>
wrote:

Hello,

I've a setup with a master and a slave artemis broker.

If I'm shutting down the master, the slave is taking over as expected,
but the applications are not able to reconnect to the backup.

The connection URL I'm using is
"(tcp://dl02130v.example.com:61616)?ha=true", the application should
know about the backup during the initial connection:

2019-12-03 15:24:24.550 DEBUG 17220 --- [enerContainer-1]
o.a.a.a.c.c.i.ClientSessionFactoryImpl   : Trying reconnection attempt 0/1
2019-12-03 15:24:24.550 DEBUG 17220 --- [enerContainer-1]
o.a.a.a.c.c.i.ClientSessionFactoryImpl   : Trying to connect with
connectorFactory =
org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory@65bf6444,
connectorConfig=TransportConfiguration(name=DL02130V-61616,
factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory)
?port=61616&host=dl02130v-example-com
2019-12-03 15:24:24.550 DEBUG 17220 --- [enerContainer-1]
o.a.a.a.c.r.impl.netty.NettyConnector    : Connector NettyConnector [host=
dl02130v.example.com, port=61616, httpEnabled=false,
httpUpgradeEnabled=false, useServlet=false,
servletPath=/messaging/ActiveMQServlet, sslEnabled=false, useNio=true]
using native epoll
2019-12-03 15:24:24.551 DEBUG 17220 --- [enerContainer-1]
org.apache.activemq.artemis.core.client  : AMQ211002: Started EPOLL Netty
Connector version 4.1.39.Final to dl02130v.example.com:61616
2019-12-03 15:24:24.551 DEBUG 17220 --- [enerContainer-1]
o.a.a.a.c.r.impl.netty.NettyConnector    : Remote destination:
dl02130v.example.com/10.122.54.210:61616
2019-12-03 <http://dl02130v.example.com/10.122.54.210:616162019-12-03>
15:24:24.552 DEBUG 17220 --- [-netty-threads)]
o.a.a.a.c.r.impl.netty.NettyConnector    : Added
ActiveMQClientChannelHandler to Channel with id = 6a57551c
2019-12-03 15:24:24.555 DEBUG 17220 --- [enerContainer-1]
o.a.a.a.c.c.i.ClientSessionFactoryImpl   : Reconnection successful
2019-12-03 15:24:24.578 DEBUG 17220 --- [-netty-threads)]
o.a.a.a.c.r.impl.netty.NettyConnector    : NettyConnector [host=
dl02130v.example.com, port=61616, httpEnabled=false,
httpUpgradeEnabled=false, useServlet=false,
servletPath=/messaging/ActiveMQServlet, sslEnabled=false, useNio=true] host
1: dl02131v.example.com ip address: 10.122.54.236 host 2:
dl02130v.example.com ip address: 10.122.54.210
2019-12-03 15:24:24.579 DEBUG 17220 --- [-netty-threads)]
o.a.a.a.c.c.i.ClientSessionFactoryImpl   : Setting up backup config =
TransportConfiguration(name=DL02131V-61616,
factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory)
?port=61616&host=dl02131v-example-com
   for live = TransportConfiguration(name=DL02130V-61616,
factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory)
?port=61616&host=dl02130v-example-com

But then, in the following log, you can see that the application
complains that the "Backup is not active" and I'm not sure why:

2019-12-03 15:26:13.472 DEBUG 17220 --- [enerContainer-1]
o.a.a.a.c.c.i.ClientSessionFactoryImpl   : Trying reconnection attempt 0/1
2019-12-03 15:26:13.472 DEBUG 17220 --- [enerContainer-1]
o.a.a.a.c.c.i.ClientSessionFactoryImpl   : Trying to connect with
connectorFactory =
org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory@3f8b8fb2,
connectorConfig=TransportConfiguration(name=null,
factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory)
?port=61616&host=dl02130v-example-com&ha=true
2019-12-03 15:26:13.473 DEBUG 17220 --- [enerContainer-1]
o.a.a.a.c.r.impl.netty.NettyConnector    : Connector NettyConnector [host=
dl02130v.example.com, port=61616, httpEnabled=false,
httpUpgradeEnabled=false, useServlet=false,
servletPath=/messaging/ActiveMQServlet, sslEnabled=false, useNio=true]
using native epoll
2019-12-03 15:26:13.473 DEBUG 17220 --- [enerContainer-1]
org.apache.activemq.artemis.core.client  : AMQ211002: Started EPOLL Netty
Connector version 4.1.39.Final to dl02130v.example.com:61616
2019-12-03 15:26:13.474 DEBUG 17220 --- [enerContainer-1]
o.a.a.a.c.r.impl.netty.NettyConnector    : Remote destination:
dl02130v.example.com/10.122.54.210:61616
2019-12-03 <http://dl02130v.example.com/10.122.54.210:616162019-12-03>
15:26:13.476 DEBUG 17220 --- [-netty-threads)]
o.a.a.a.c.r.impl.netty.NettyConnector    : Added
ActiveMQClientChannelHandler to Channel with id = 6ab78494
2019-12-03 15:26:13.484 DEBUG 17220 --- [enerContainer-1]
o.a.a.a.c.c.i.ClientSessionFactoryImpl   : Connector towards NettyConnector
[host=dl02130v.example.com, port=61616, httpEnabled=false,
httpUpgradeEnabled=false, useServlet=false,
servletPath=/messaging/ActiveMQServlet, sslEnabled=false, useNio=true]
failed
2019-12-03 15:26:13.484 DEBUG 17220 --- [enerContainer-1]
o.a.a.a.c.c.i.ClientSessionFactoryImpl   : Backup is not active, trying
original connection configuration now.
2019-12-03 15:26:13.485 ERROR 17220 --- [enerContainer-1]
o.s.j.l.DefaultMessageListenerContainer  : Could not refresh JMS Connection
for destination 'DLQ' - retrying using FixedBackOff{interval=5000,
currentAttempts=11, maxAttempts=unlimited}. Cause: Failed to create session
factory; nested exception is
ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ219007:
Cannot connect to server(s). Tried with all available servers.]

javax.jms.JMSException: Failed to create session factory
         at
org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:886)
~[artemis-jms-client-2.10.0.jar!/:2.10.0]
         at
org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:299)
~[artemis-jms-client-2.10.0.jar!/:2.10.0]
         at
org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:294)
~[artemis-jms-client-2.10.0.jar!/:2.10.0]
         at
org.messaginghub.pooled.jms.JmsPoolConnectionFactory.createProviderConnection(JmsPoolConnectionFactory.java:650)
~[pooled-jms-1.0.6.jar!/:na]
         at
org.messaginghub.pooled.jms.JmsPoolConnectionFactory$1.makeObject(JmsPoolConnectionFactory.java:107)
~[pooled-jms-1.0.6.jar!/:na]
         at
org.messaginghub.pooled.jms.JmsPoolConnectionFactory$1.makeObject(JmsPoolConnectionFactory.java:104)
~[pooled-jms-1.0.6.jar!/:na]
         at
org.apache.commons.pool2.impl.GenericKeyedObjectPool.create(GenericKeyedObjectPool.java:1041)
~[commons-pool2-2.6.2.jar!/:2.6.2]
         at
org.apache.commons.pool2.impl.GenericKeyedObjectPool.addObject(GenericKeyedObjectPool.java:1233)
~[commons-pool2-2.6.2.jar!/:2.6.2]
         at
org.messaginghub.pooled.jms.JmsPoolConnectionFactory.createJmsPoolConnection(JmsPoolConnectionFactory.java:704)
~[pooled-jms-1.0.6.jar!/:na]
         at
org.messaginghub.pooled.jms.JmsPoolConnectionFactory.createConnection(JmsPoolConnectionFactory.java:236)
~[pooled-jms-1.0.6.jar!/:na]
         at
org.messaginghub.pooled.jms.JmsPoolConnectionFactory.createConnection(JmsPoolConnectionFactory.java:231)
~[pooled-jms-1.0.6.jar!/:na]
         at
org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:196)
~[spring-jms-5.1.10.RELEASE.jar!/:5.1.10.RELEASE]
         at
org.springframework.jms.listener.DefaultMessageListenerContainer.refreshConnectionUntilSuccessful(DefaultMessageListenerContainer.java:944)
~[spring-jms-5.1.10.RELEASE.jar!/:5.1.10.RELEASE]
         at
org.springframework.jms.listener.DefaultMessageListenerContainer.recoverAfterListenerSetupFailure(DefaultMessageListenerContainer.java:915)
~[spring-jms-5.1.10.RELEASE.jar!/:5.1.10.RELEASE]
         at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1099)
~[spring-jms-5.1.10.RELEASE.jar!/:5.1.10.RELEASE]
         at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
Caused by:
org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException:
AMQ219007: Cannot connect to server(s). Tried with all available servers.
         at
org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:798)
~[artemis-core-client-2.10.0.jar!/:2.10.0]
         at
org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:884)
~[artemis-jms-client-2.10.0.jar!/:2.10.0]
         ... 15 common frames omitted

An idea what's happening here?

Kind regards,

Laurent Bigonville


Reply via email to