title: Connection factory shut down after several failback
body: <p>I have a JBoss cluster with two nodes in HA shared store mode.</p>
  
  <p>When I kill the live node 1, backup node 2 become the live one.</p>
  
  <p>When I restart node 1, thanks to failback, node 1 become the live server, and node 2 become, again, the backup server.</p>
  
  <p>But, when I kill again the node 1, node 2 become the live server, but I get the following exception:</p>
  
  <pre><code>10:38:46,545 WARN  [org.apache.camel.component.jms.reply.TemporaryQueueReplyManager] (Camel (camel-poc) thread #20 - TemporaryQueueReplyManager[MY_QUEUE]) Exception inside the DMLC for Temporary ReplyTo Queue for destination MY_QUEUE, refreshing ReplyTo destination: javax.jms.JMSException: Could not create a session: IJ000470: You are trying to use a connection factory that has been shut down: java:/JmsXA
          at org.apache.activemq.artemis.ra.ActiveMQRASessionFactoryImpl.allocateConnection(ActiveMQRASessionFactoryImpl.java:895)
          at org.apache.activemq.artemis.ra.ActiveMQRASessionFactoryImpl.createSession(ActiveMQRASessionFactoryImpl.java:520)
          at org.springframework.jms.support.JmsAccessor.createSession(JmsAccessor.java:192)
          at org.springframework.jms.listener.DefaultMessageListenerContainer.access$1400(DefaultMessageListenerContainer.java:124)
          at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.initResourcesIfNecessary(DefaultMessageListenerContainer.java:1186)
          at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1165)
          at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1158)
          at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1055)
          at java.lang.Thread.run(Thread.java:748)
  Caused by: javax.resource.ResourceException: IJ000470: You are trying to use a connection factory that has been shut down: java:/JmsXA
          at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:735)
          at org.apache.activemq.artemis.ra.ActiveMQRASessionFactoryImpl.allocateConnection(ActiveMQRASessionFactoryImpl.java:853)
          ... 8 more
  </code></pre>
  
  <p>And of course, I cannot use this queue anymore. </p>
  
  <p>Here is my messaging subsystem definition (basically the same as defined in standalone-ha configuration) :</p>
  
  <pre><code>    &lt;subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0"&gt;
          &lt;server name="default"&gt;
              &lt;cluster password="${jboss.messaging.cluster.password:admin123!}"/&gt;
              &lt;management jmx-enabled="true"/&gt;
              &lt;statistics enabled="true"/&gt;
              &lt;shared-store-slave allow-failback="true"/&gt;
              &lt;bindings-directory path="D:\dev\tools\jboss-eap\jboss-eap-7.0.0-ha\shared_jboss\bindings"/&gt;
              &lt;journal-directory path="D:\dev\tools\jboss-eap\jboss-eap-7.0.0-ha\shared_jboss\journal"/&gt;
              &lt;large-messages-directory path="D:\dev\tools\jboss-eap\jboss-eap-7.0.0-ha\shared_jboss\largemessages"/&gt;
              &lt;paging-directory path="D:\dev\tools\jboss-eap\jboss-eap-7.0.0-ha\shared_jboss\paging"/&gt;
              &lt;security-setting name="#"&gt;
                  &lt;role name="guest" delete-non-durable-queue="true" create-non-durable-queue="true" consume="true" send="true"/&gt;
              &lt;/security-setting&gt;
              &lt;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"/&gt;
              &lt;http-connector name="http-connector" endpoint="http-acceptor" socket-binding="http"/&gt;
              &lt;http-connector name="http-connector-throughput" endpoint="http-acceptor-throughput" socket-binding="http"&gt;
                  &lt;param name="batch-delay" value="50"/&gt;
              &lt;/http-connector&gt;
              &lt;in-vm-connector name="in-vm" server-id="0"/&gt;
              &lt;http-acceptor name="http-acceptor" http-listener="default"/&gt;
              &lt;http-acceptor name="http-acceptor-throughput" http-listener="default"&gt;
                  &lt;param name="batch-delay" value="50"/&gt;
                  &lt;param name="direct-deliver" value="false"/&gt;
              &lt;/http-acceptor&gt;
              &lt;in-vm-acceptor name="in-vm" server-id="0"/&gt;
              &lt;broadcast-group name="bg-group1" connectors="http-connector" jgroups-channel="activemq-cluster"/&gt;
              &lt;discovery-group name="dg-group1" jgroups-channel="activemq-cluster"/&gt;
              &lt;cluster-connection name="my-cluster" discovery-group="dg-group1" connector-name="http-connector" address="jms"/&gt;
              &lt;jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/&gt;
              &lt;jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/&gt;
              &lt;jms-queue name="MY_QUEUE" entries="java:/jms/queue/MY_QUEUE"/&gt;
              &lt;connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/&gt;
              &lt;connection-factory name="RemoteConnectionFactory" reconnect-attempts="-1" block-on-acknowledge="true" ha="true" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector"/&gt;
              &lt;pooled-connection-factory name="activemq-ra" transaction="xa" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm"/&gt;
          &lt;/server&gt;
      &lt;/subsystem&gt;
  </code></pre>
  
  <p>Is it a normal behavior or something is misconfigured?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>The consumer is deployed on the live server and on the backup server. The queue is used in a Camel context and its defined in the context as follow:</p>
  
  <pre><code>&lt;jee:jndi-lookup id="jmsConnectionFactory"
      jndi-name="java:jboss/DefaultJMSConnectionFactory" lookup-on-startup="false"
      proxy-interface="javax.jms.ConnectionFactory" /&gt;
  
  &lt;bean id="jms" class="org.apache.camel.component.jms.JmsComponent"&gt;
      &lt;property name="connectionFactory" ref="jmsConnectionFactory" /&gt;
  &lt;/bean&gt;
  
  &lt;camelContext xmlns="http://camel.apache.org/schema/spring"
      xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hel="http://cxf.apache.org/wsse/handler/hell"
      trace="true" id="camel-jms-queue"&gt;
      &lt;route id="wsProxyRedirection"&gt;
          &lt;from uri="cxf:bean:cdcPocProxyWebServiceStartPoint" /&gt;
          &lt;to uri="jms:queue:MY_QUEUE" /&gt;
      &lt;/route&gt;
  &lt;/camelContext&gt;
  </code></pre>