2 Replies Latest reply on Jan 2, 2016 12:27 PM by vincent.sourin

    Wildfly 10.0.0.CR5 - JMS Standalone client Failover problem

    vincent.sourin

      Hello,

       

      I have a problem with a standalone JMS Client connecting to a cluster of wildfly embedded artemis servers.

      Here an excerpt of my configuration (full config is in attachment) :

       

      <subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0">
      
                      <server name="default">
      
                          <cluster password="${jboss.messaging.cluster.password:vs1979anpasswdcluster}"/>
      
                          <replication-colocated excluded-connectors="netty-connector" request-backup="true">
      
                              <master check-for-live-server="true" cluster-name="my-cluster"/>
      
                              <slave cluster-name="my-cluster" allow-failback="true" restart-backup="true"/>
      
                          </replication-colocated>
      
                          <security-setting name="#">
      
                              <role name="guest" delete-non-durable-queue="true" create-non-durable-queue="true" consume="true" send="true"/>
      
                          </security-setting>
      
                          <address-setting name="#" redistribution-delay="1000" message-counter-history-day-limit="10" page-size-bytes="2097152" max-size-bytes="10485760" expiry-address="jms.queue.ExpiryQueue" dead-letter-address="jms.queue.DLQ"/>
      
                          <http-connector name="http-connector" endpoint="http-acceptor" socket-binding="http"/>
      
                          <http-connector name="http-connector-throughput" endpoint="http-acceptor-throughput" socket-binding="http">
      
                              <param name="batch-delay" value="50"/>
      
                          </http-connector>
      
                          <remote-connector name="netty-connector" socket-binding="messaging">
      
                              <param name="protocols" value="OPENWIRE"/>
      
                          </remote-connector>
      
                          <in-vm-connector name="in-vm" server-id="0"/>
      
                          <http-acceptor name="http-acceptor" http-listener="default"/>
      
                          <http-acceptor name="http-acceptor-throughput" http-listener="default">
      
                              <param name="batch-delay" value="50"/>
      
                              <param name="direct-deliver" value="false"/>
      
                          </http-acceptor>
      
                          <remote-acceptor name="netty-acceptor" socket-binding="messaging">
      
                              <param name="protocols" value="OPENWIRE"/>
      
                          </remote-acceptor>
      
                          <in-vm-acceptor name="in-vm" server-id="0"/>
      
                          <broadcast-group name="bg-group1" connectors="http-connector" jgroups-channel="activemq-cluster" jgroups-stack="udp"/>
      
                          <discovery-group name="dg-group1" jgroups-channel="activemq-cluster" jgroups-stack="udp"/>
      
                          <cluster-connection name="my-cluster" discovery-group="dg-group1" connector-name="http-connector" address="jms"/>
      
                          <jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
      
                          <jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
      
                          <jms-queue name="PanoramaScanPresses" entries="java:jboss/exported/jms/queue/PanoramaScanPresses"/>
      
                          <connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
      
                          <connection-factory name="RemoteConnectionFactory" failover-on-initial-connection="true" reconnect-attempts="-1" block-on-acknowledge="true" ha="true" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector"/>
      
                          <pooled-connection-factory name="activemq-ra" transaction="xa" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm"/>
      
                      </server>
      
                  </subsystem>
      

       

       

      And here a simple program producing message in a loop :

       

         Properties env = new Properties();
      
                  env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
      
                  env.put(Context.PROVIDER_URL, System.getProperty(Context.PROVIDER_URL, "http-remoting://server1:8080,http-remoting://server2:8080"));
      
                  env.put(Context.SECURITY_PRINCIPAL, System.getProperty("username", "user"));
      
                  env.put(Context.SECURITY_CREDENTIALS, System.getProperty("password", "pass"));
      
                  Context jndiContext = new InitialContext(env);
                 
      
                  connectionFactory = (ConnectionFactory) jndiContext.lookup("jms/RemoteConnectionFactory");
      
                  queue = (Destination) jndiContext.lookup("java:jms/queue/PanoramaScanPresses");
      
                  jndiContext.close();           
      
                  jmsContext = connectionFactory.createContext("user", "pass", JMSContext.AUTO_ACKNOWLEDGE);
              while(true) {
              jmsContext.createProducer().setDeliveryMode(DeliveryMode.PERSISTENT).setTimeToLive(60000).send(queue, jmsContext.createTextMessage("TEST MSG"));
              try {
                  Thread.sleep(4000);
              } catch (InterruptedException e) {
                  e.printStackTrace();
              }
             }
      

       

      When launching program everything works fine but when I stop the server where the client is connected, the client doesn't failover and stops producing message with this warning :

       

      janv. 01, 2016 3:36:13 PM org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl fail
      WARN: AMQ212037: Connection failure has been detected: AMQ119015: The connection was disconnected because of server shutdown [code=DISCONNECTED]
      

       

      In the log of wildfly servers I can see that the failover occurs but with some warnings :

       

      [Server:server2] 15:36:14,160 WARN  [org.apache.activemq.artemis.core.client] (Thread-6 (ActiveMQ-client-global-threads-1950618982)) AMQ212037: Connection failure has been detected: AMQ119015: The connection was disconnected because of server shutdown [code=DISCONNECTED]
      [Server:server2] 15:36:14,161 WARN  [org.apache.activemq.artemis.core.client] (Thread-8 (ActiveMQ-client-global-threads-1950618982)) AMQ212037: Connection failure has been detected: AMQ119015: The connection was disconnected because of server shutdown [code=DISCONNECTED]
      [Server:server2] 15:36:14,161 WARN  [org.apache.activemq.artemis.core.client] (Thread-7 (ActiveMQ-client-global-threads-1950618982)) AMQ212037: Connection failure has been detected: AMQ119015: The connection was disconnected because of server shutdown [code=DISCONNECTED]
      [Server:server2] 15:36:14,161 WARN  [org.apache.activemq.artemis.core.client] (Thread-9 (ActiveMQ-client-global-threads-1950618982)) AMQ212037: Connection failure has been detected: AMQ119015: The connection was disconnected because of server shutdown [code=DISCONNECTED]
      [Server:server2] 15:36:14,164 WARN  [org.apache.activemq.artemis.core.server] (Thread-6 (ActiveMQ-client-global-threads-1950618982)) AMQ222095: Connection failed with failedOver=false
      [Server:server2] 15:36:14,175 WARN  [org.apache.activemq.artemis.core.server] (Thread-6 (ActiveMQ-client-global-threads-1950618982)) AMQ222095: Connection failed with failedOver=false
      [Server:server2] 15:36:14,177 INFO  [org.apache.activemq.artemis.core.server] (Thread-1 (ActiveMQ-server-org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl$2@1b0bd78c-1447847339)) AMQ221029: stopped bridge sf.my-cluster.4bcd2d0b-b083-11e5-8f5d-27193c768735
      [Server:server2] 15:36:14,205 WARN  [org.apache.activemq.artemis.core.client] (Thread-11 (ActiveMQ-client-global-threads-1950618982)) AMQ212037: Connection failure has been detected: AMQ119015: The connection was disconnected because of server shutdown [code=DISCONNECTED]
      [Server:server2] 15:36:14,226 INFO  [org.apache.activemq.artemis.core.server] (AMQ119000: Activation for server ActiveMQServerImpl::serverUUID=null) AMQ221037: ActiveMQServerImpl::serverUUID=4bcd2d0b-b083-11e5-8f5d-27193c768735 to become 'live'
      [Server:server2] 15:36:15,520 WARN  [org.apache.activemq.artemis.core.client] (activemq-discovery-group-thread-dg-group1) AMQ212034: There are more than one servers on the network broadcasting the same node id. You will see this message exactly once (per node) if a node is restarted, in which case it can be safely ignored. But if it is logged continuously it means you really do have more than one node on the same network active concurrently with the same node id. This could occur if you have a backup node active at the same time as its live node. nodeID=4bcd2d0b-b083-11e5-8f5d-27193c768735
      [Server:server2] 15:36:15,521 INFO  [org.apache.activemq.artemis.core.server] (AMQ119000: Activation for server ActiveMQServerImpl::serverUUID=null) AMQ221007: Server is now live
      [Server:server2] 15:36:15,520 WARN  [org.apache.activemq.artemis.core.client] (activemq-discovery-group-thread-dg-group1) AMQ212034: There are more than one servers on the network broadcasting the same node id. You will see this message exactly once (per node) if a node is restarted, in which case it can be safely ignored. But if it is logged continuously it means you really do have more than one node on the same network active concurrently with the same node id. This could occur if you have a backup node active at the same time as its live node. nodeID=4bcd2d0b-b083-11e5-8f5d-27193c768735
      [Server:server2] 15:36:15,520 WARN  [org.apache.activemq.artemis.core.client] (activemq-discovery-group-thread-dg-group1) AMQ212034: There are more than one servers on the network broadcasting the same node id. You will see this message exactly once (per node) if a node is restarted, in which case it can be safely ignored. But if it is logged continuously it means you really do have more than one node on the same network active concurrently with the same node id. This could occur if you have a backup node active at the same time as its live node. nodeID=4bcd2d0b-b083-11e5-8f5d-27193c768735
      

       

      Can someone tell me what I'm doing wrong and how I can acheive correct failover with a standalone client ?

       

      Thanks in advance.

       

      Vincent.