title: Spring websockets across Wildfly 10.1 cluster
body: <p>Using Wildfly 10.1 standalone-full-ha.xml with the included ActiveMQ Artemis 1.1.0. Enabled STOMP by adding this to the activemq config:</p>
  
  <pre><code>&lt;acceptor name="stomp-acceptor" factory-class="org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory"&gt;
     &lt;param name="protocols" value="STOMP"/&gt;
     &lt;param name="port" value="${stomp.port:61613}"/&gt;
  &lt;/acceptor&gt;
  </code></pre>
  
  <p>Deployed a sample spring websockets war based on <a href="https://spring.io/guides/gs/messaging-stomp-websocket/" rel="nofollow noreferrer">https://spring.io/guides/gs/messaging-stomp-websocket/</a></p>
  
  <p>I have this running on 2 separate servers which are able to form a cluster. I am able to connect to both servers and send messages across, however when I disconnect one of the websockets, the following exception is thrown on the other server: </p>
  
  <pre><code>16:49:02,377 ERROR [org.apache.activemq.artemis.core.server] (Thread-7 (ActiveMQ-client-global-threads-926891052)) AMQ224037: cluster connection Failed to handle message: java.lang.IllegalStateException: Cannot find binding for ffaa538e-77c3-11e7-ba4b-7b9cb7ee40e2b7e6493a-77c3-11e7-ba4b-7b9cb7ee40e2
          at org.apache.activemq.artemis.core.server.cluster.impl.ClusterConnectionImpl$MessageFlowRecordImpl.doConsumerClosed(ClusterConnectionImpl.java:1319)
          at org.apache.activemq.artemis.core.server.cluster.impl.ClusterConnectionImpl$MessageFlowRecordImpl.handleNotificationMessage(ClusterConnectionImpl.java:1005)
          at org.apache.activemq.artemis.core.server.cluster.impl.ClusterConnectionImpl$MessageFlowRecordImpl.onMessage(ClusterConnectionImpl.java:974)
          at org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:1018)
          at org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl.access$400(ClientConsumerImpl.java:48)
          at org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:1145)
          at org.apache.activemq.artemis.utils.OrderedExecutorFactory$OrderedExecutor$ExecutorTask.run(OrderedExecutorFactory.java:103)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
          at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>I have also tested this with Wildfly 11 Alpha and the included ActiveMQ Artemis 1.5.3 but I get the same error every time I disconnect a websocket. </p>
  
  <p>I also get the following errors when I shutdown a server, but I am less concerned about these since they only happen during shutdown:</p>
  
  <pre><code>17:11:03,747 ERROR [org.apache.activemq.artemis.core.server] (Thread-27 (ActiveMQ-server-org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl$2@5669232b-14602972)) AMQ224051: Failed to call notification listener: java.lang.IllegalStateException: No queue 0110e86e-77c4-11e7-a745-252881f696b4
          at org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl.onNotification(PostOfficeImpl.java:387)
          at org.apache.activemq.artemis.core.server.management.impl.ManagementServiceImpl.sendNotification(ManagementServiceImpl.java:580)
          at org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl.close(ServerConsumerImpl.java:437)
          at org.apache.activemq.artemis.core.server.impl.ServerSessionImpl.doClose(ServerSessionImpl.java:354)
          at org.apache.activemq.artemis.core.server.impl.ServerSessionImpl$1.done(ServerSessionImpl.java:1191)
          at org.apache.activemq.artemis.core.persistence.impl.journal.OperationContextImpl.executeOnCompletion(OperationContextImpl.java:161)
          at org.apache.activemq.artemis.core.server.impl.ServerSessionImpl.close(ServerSessionImpl.java:1185)
          at org.apache.activemq.artemis.core.protocol.stomp.StompProtocolManager$1.run(StompProtocolManager.java:276)
          at org.apache.activemq.artemis.utils.OrderedExecutorFactory$OrderedExecutor$ExecutorTask.run(OrderedExecutorFactory.java:103)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
          at java.lang.Thread.run(Thread.java:745)
  
  17:11:03,784 ERROR [io.netty.util.concurrent.DefaultPromise.rejectedExecution] (globalEventExecutor-1-2) Failed to submit a listener notification task. Event loop shut down?: java.util.concurrent.RejectedExecutionException: event executor terminated
          at io.netty.util.concurrent.SingleThreadEventExecutor.reject(SingleThreadEventExecutor.java:821)
          at io.netty.util.concurrent.SingleThreadEventExecutor.offerTask(SingleThreadEventExecutor.java:327)
          at io.netty.util.concurrent.SingleThreadEventExecutor.addTask(SingleThreadEventExecutor.java:320)
          at io.netty.util.concurrent.SingleThreadEventExecutor.execute(SingleThreadEventExecutor.java:746)
          at io.netty.util.concurrent.DefaultPromise.safeExecute(DefaultPromise.java:760)
          at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:428)
          at io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:104)
          at io.netty.channel.DefaultChannelPromise.trySuccess(DefaultChannelPromise.java:82)
          at io.netty.channel.AbstractChannel$CloseFuture.setClosed(AbstractChannel.java:1058)
          at io.netty.channel.AbstractChannel$AbstractUnsafe.doClose0(AbstractChannel.java:686)
          at io.netty.channel.AbstractChannel$AbstractUnsafe.access$700(AbstractChannel.java:419)
          at io.netty.channel.AbstractChannel$AbstractUnsafe$5.run(AbstractChannel.java:646)
          at io.netty.util.concurrent.GlobalEventExecutor$TaskRunner.run(GlobalEventExecutor.java:233)
          at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
          at java.lang.Thread.run(Thread.java:745)
  
  17:11:03,797 WARN  [io.netty.channel.AbstractChannel] (globalEventExecutor-1-2) Can't invoke task later as EventLoop rejected it: java.util.concurrent.RejectedExecutionException: event executor terminated
          at io.netty.util.concurrent.SingleThreadEventExecutor.reject(SingleThreadEventExecutor.java:821)
          at io.netty.util.concurrent.SingleThreadEventExecutor.offerTask(SingleThreadEventExecutor.java:327)
          at io.netty.util.concurrent.SingleThreadEventExecutor.addTask(SingleThreadEventExecutor.java:320)
          at io.netty.util.concurrent.SingleThreadEventExecutor.execute(SingleThreadEventExecutor.java:746)
          at io.netty.channel.AbstractChannel$AbstractUnsafe.invokeLater(AbstractChannel.java:931)
          at io.netty.channel.AbstractChannel$AbstractUnsafe.access$900(AbstractChannel.java:419)
          at io.netty.channel.AbstractChannel$AbstractUnsafe$5.run(AbstractChannel.java:649)
          at io.netty.util.concurrent.GlobalEventExecutor$TaskRunner.run(GlobalEventExecutor.java:233)
          at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
          at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>Is it an issue with the spring websocket example?</p>
  
  <p>Do I need to change something in the default standalone-full-ha.xml to get this to work properly across a cluster, without throwing exceptions on client disconnect?  </p>