Hi Justin, thanks for reply
I have migrated to wildfly10 and artemisq , but i have same problem, my client exception is
Jun 15, 2017 6:42:05 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]
Failover event triggered :FAILURE_DETECTED
Jun 15, 2017 6:42:09 PM org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl getConnectionWithRetry
WARN: AMQ212005: Tried 5 times to connect. Now giving up on reconnecting it.
Failover event triggered :FAILOVER_FAILED
Exception in thread "main" javax.jms.JMSException: AMQ119016: Connection failure detected. Unblocking a blocking call that will never get a response
at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:406)
at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:304)
at org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQSessionContext.sendFullMessage(ActiveMQSessionContext.java:378)
at org.apache.activemq.artemis.core.client.impl.ClientProducerImpl.sendRegularMessage(ClientProducerImpl.java:286)
at org.apache.activemq.artemis.core.client.impl.ClientProducerImpl.doSend(ClientProducerImpl.java:264)
at org.apache.activemq.artemis.core.client.impl.ClientProducerImpl.send(ClientProducerImpl.java:122)
at org.apache.activemq.artemis.jms.client.ActiveMQMessageProducer.doSendx(ActiveMQMessageProducer.java:477)
at org.apache.activemq.artemis.jms.client.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:173)
at Application.main(Application.java:65)
Caused by: ActiveMQUnBlockedException[errorType=UNBLOCKED message=AMQ119016: Connection failure detected. Unblocking a blocking call that will never get a response]
... 9 more
my master log (Stop with Ctrl+C):
Server:server-three] 10:26:57,901 DEBUG [org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl] (ServerService Thread Pool -- 76) Message ServerMessage[messageID=1486,durable=true,userID=null,priority=0, bodySize=512, timestamp=0,expiration=0, durable=true, address=activemq.notifications,properties=TypedProperties[factory=org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory,_AMQ_NotifType=ACCEPTOR_STOPPED,_AMQ_NotifTimestamp=1497536817901,id=0]]@1041289119 is not going anywhere as it didn't have a binding on address:activemq.notifications
[Server:server-three] 10:26:57,916 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 76) AMQ221002: Apache ActiveMQ Artemis Message Broker version 1.1.0.wildfly-017 [4bfaac95-51d6-11e7-9a67-39317e17614a] stopped
[Server:server-three] 10:26:57,917 DEBUG [org.jboss.as.security] (MSC service thread 1-1) Stopping security domain service other
[Server:server-three] 10:26:57,917 INFO [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0008: Undertow HTTP listener default suspending
[Server:server-three] 10:26:57,918 INFO [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0007: Undertow HTTP listener default stopped, was bound to 192.168.0.200:8330
[Server:server-three] 10:26:57,925 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0004: Undertow 1.4.0.Final stopping
[Server:server-three] 10:26:57,930 DEBUG [org.jgroups.protocols.UDP] (multicast receiver,ee,master:server-three) receiver socket is closed, exception=java.net.SocketException: Socket closed
[Server:server-three] 10:26:57,930 DEBUG [org.jgroups.protocols.UDP] (multicast receiver,ee,master:server-three) multicast receiver thread terminated
[Server:server-three] 10:26:57,930 DEBUG [org.jgroups.protocols.UDP] (MSC service thread 1-2) multicast socket closed
[Server:server-three] 10:26:57,931 DEBUG [org.jgroups.protocols.UDP] (unicast receiver,ee,master:server-three) receiver socket is closed, exception=java.net.SocketException: Socket closed
[Server:server-three] 10:26:57,931 DEBUG [org.jgroups.protocols.UDP] (unicast receiver,ee,master:server-three) unicast receiver thread terminated
[Server:server-three] 10:26:57,931 DEBUG [org.jgroups.protocols.UDP] (MSC service thread 1-2) closing sockets and stopping threads
[Server:server-three] 10:26:57,950 DEBUG [org.jboss.as.server] (ServerService Thread Pool -- 76) DeploymentMountProvider stopped
[Host Controller] 10:26:57,955 INFO [org.jboss.as.host.controller] (management I/O-1) WFLYHC0027: Unregistering server server-three
[Server:server-three] 10:26:57,970 INFO [org.jboss.as] (MSC service thread 1-1) WFLYSRV0050: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final) stopped in 309ms
[Server:server-three]
10:26:58,296 INFO [org.jboss.as.process.Server:server-three.status] (reaper for Server:server-three) WFLYPC0011: Process 'Server:server-three' finished with an exit status of 130
[Host Controller] 10:26:58,298 INFO [org.jboss.as.host.controller] (ProcessControllerConnection-thread - 2) WFLYHC0027: Unregistering server server-three
[Host Controller] 10:26:58,339 WARN [org.jboss.as.domain.controller] (MSC service thread 1-1) WFLYHC0030: Connection to remote host "slave" closed unexpectedly
[Host Controller] 10:26:58,351 INFO [org.jboss.as] (MSC service thread 1-1) WFLYSRV0050: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final) stopped in 723ms
[Host Controller]
10:26:58,356 INFO [org.jboss.as.process.Host Controller.status] (reaper for Host Controller) WFLYPC0011: Process 'Host Controller' finished with an exit status of 130
10:26:58,358 INFO [org.jboss.as.process] (Shutdown thread) WFLYPC0016: All processes finished; exiting
and my slave log:
[Server:server-three] 10:26:50,666 WARN [org.jgroups.protocols.UDP] (thread-1,ee,slave:server-three) JGRP000012: discarded message from different cluster activemq-cluster (our cluster is ee). Sender was slave:server-three (received 72 identical messages from slave:server-three in the last 60025 ms)
[Server:server-three] 10:26:58,033 DEBUG [org.jboss.activemq.artemis.wildfly.integration.recovery] (Periodic Recovery)
[Server:server-three] =======================================================================================
[Server:server-three] 10:26:58,033 DEBUG [org.jboss.activemq.artemis.wildfly.integration.recovery] (Periodic Recovery) Returning the following list on getXAREsources:
[Server:server-three] 10:26:58,033 DEBUG [org.jboss.activemq.artemis.wildfly.integration.recovery] (Periodic Recovery) server-id=944907bb-51d4-11e7-b51d-43814264a759, value=org.jboss.activemq.artemis.wildfly.integration.WildFlyActiveMQXAResourceWrapper@6a8cc10c
[Server:server-three] 10:26:58,033 DEBUG [org.jboss.activemq.artemis.wildfly.integration.recovery] (Periodic Recovery) =======================================================================================
[Server:server-three]
[Server:server-three] 10:26:58,033 DEBUG [org.jboss.ejb.client.txn] (Periodic Recovery) Send recover request for transaction origin node identifier 1 to EJB receiver with node name slave:server-three
[Server:server-three] 10:26:58,033 DEBUG [org.apache.activemq.artemis.service.extensions.xa.recovery] (Periodic Recovery) looking for recover at ClientSessionImpl [name=df549be0-51d4-11e7-b51d-43814264a759, username=null, closed=false, factory = org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl@10a82f1, metaData=()]@5613459d configuration [XARecoveryConfig [transportConfiguration=[TransportConfiguration(name=, factory=org-apache-activemq-artemis-core-remoting-impl-invm-InVMConnectorFactory) ?serverId=0], discoveryConfiguration=null, username=null, password=****, JNDI_NAME=java:/JmsXA]]
[Host Controller] 10:26:58,322 WARN [org.jboss.as.host.controller] (management task-1) WFLYHC0015: Connection to remote host-controller closed. Trying to reconnect.
[Host Controller] 10:26:58,324 INFO [org.jboss.as.host.controller] (Host Controller Service Threads - 10) WFLYHC0150: Trying to reconnect to master host controller.
[Host Controller] 10:26:59,330 INFO [org.jboss.as.host.controller] (Host Controller Service Threads - 10) WFLYHC0150: Trying to reconnect to master host controller.
[Server:server-three] 10:27:02,580 DEBUG [org.apache.activemq.artemis.core.server.impl.QueueImpl] (activemq-expiry-reaper-thread) Cannot expire from jms.queue.ExpiryQueue into jms.queue.ExpiryQueue
[Host Controller] 10:27:03,332 INFO [org.jboss.as.host.controller] (Host Controller Service Threads - 10) WFLYHC0150: Trying to reconnect to master host controller.
[Server:server-three] 10:27:04,392 DEBUG [org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl] (Thread-1 (ActiveMQ-client-netty-threads-264441192)) Invocation of interceptor org.apache.activemq.artemis.core.server.impl.ReplicationError on PACKET(Ping)[type=10, channelID=0, packetObject=Ping, connectionTTL=60000] returned true
[Server:server-three] 10:27:08,037 DEBUG [org.jboss.ejb.client.txn] (Periodic Recovery) Send recover request for transaction origin node identifier 1 to EJB receiver with node name slave:server-three
[Server:server-three] 10:27:08,037 DEBUG [org.apache.activemq.artemis.service.extensions.xa.recovery] (Periodic Recovery) looking for recover at ClientSessionImpl [name=df549be0-51d4-11e7-b51d-43814264a759, username=null, closed=false, factory = org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl@10a82f1, metaData=()]@5613459d configuration [XARecoveryConfig [transportConfiguration=[TransportConfiguration(name=, factory=org-apache-activemq-artemis-core-remoting-impl-invm-InVMConnectorFactory) ?serverId=0], discoveryConfiguration=null, username=null, password=****, JNDI_NAME=java:/JmsXA]]
[Host Controller] 10:27:12,335 INFO [org.jboss.as.host.controller] (Host Controller Service Threads - 10) WFLYHC0150: Trying to reconnect to master host controller.
[Host Controller] 10:27:27,345 INFO [org.jboss.as.host.controller] (Host Controller Service Threads - 10) WFLYHC0150: Trying to reconnect to master host controller.
[Server:server-three] 10:27:32,581 DEBUG [org.apache.activemq.artemis.core.server.impl.QueueImpl] (activemq-expiry-reaper-thread) Cannot expire from jms.queue.ExpiryQueue into jms.queue.ExpiryQueue
[Server:server-three] 10:27:34,393 DEBUG [org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl] (Thread-1 (ActiveMQ-client-netty-threads-264441192)) Invocation of interceptor org.apache.activemq.artemis.core.server.impl.ReplicationError on PACKET(Ping)[type=10, channelID=0, packetObject=Ping, connectionTTL=60000] returned true
[Server:server-three] 10:27:41,549 WARN [org.jgroups.protocols.UDP] (thread-1,activemq-cluster,slave:server-three) JGRP000012: discarded message from different cluster ee (our cluster is activemq-cluster). Sender was slave:server-three (received 14 identical messages from slave:server-three in the last 60169 ms)
[Host Controller] 10:27:42,347 INFO [org.jboss.as.host.controller] (Host Controller Service Threads - 10) WFLYHC0150: Trying to reconnect to master host controller.
[Server:server-three] 10:27:50,691 WARN [org.jgroups.protocols.UDP] (thread-2,ee,slave:server-three) JGRP000012: discarded message from different cluster activemq-cluster (our cluster is ee). Sender was slave:server-three (received 74 identical messages from slave:server-three in the last 60025 ms)
[Host Controller] 10:27:57,350 INFO [org.jboss.as.host.controller] (Host Controller Service Threads - 10) WFLYHC0150: Trying to reconnect to master host controller.
[Server:server-three] 10:28:02,581 DEBUG [org.apache.activemq.artemis.core.server.impl.QueueImpl] (activemq-expiry-reaper-thread) Cannot expire from jms.queue.ExpiryQueue into jms.queue.ExpiryQueue
[Server:server-three] 10:28:04,393 DEBUG [org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl] (Thread-1 (ActiveMQ-client-netty-threads-264441192)) Invocation of interceptor org.apache.activemq.artemis.core.server.impl.ReplicationError on PACKET(Ping)[type=10, channelID=0, packetObject=Ping, connectionTTL=60000] returned true
[Host Controller] 10:28:12,354 INFO [org.jboss.as.host.controller] (Host Controller Service Threads - 10) WFLYHC0150: Trying to reconnect to master host controller.
[Host Controller] 10:28:27,357 INFO [org.jboss.as.host.controller] (Host Controller Service Threads - 10) WFLYHC0150: Trying to reconnect to master host controller.
[Server:server-three] 10:28:32,582 DEBUG [org.apache.activemq.artemis.core.server.impl.QueueImpl] (activemq-expiry-reaper-thread) Cannot expire from jms.queue.ExpiryQueue into jms.queue.ExpiryQueue
[Server:server-three] 10:28:34,394 DEBUG [org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl] (Thread-1 (ActiveMQ-client-netty-threads-264441192)) Invocation of interceptor org.apache.activemq.artemis.core.server.impl.ReplicationError on PACKET(Ping)[type=10, channelID=0, packetObject=Ping, connectionTTL=60000] returned true
my master config:
<subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0">
<server name="default">
<security enabled="false"/>
<cluster password="${jboss.messaging.cluster.password:sh@1396SM}"/>
<replication-master check-for-live-server="true" group-name="ali-server-group" cluster-name="my-cluster"/>
<security-setting name="#">
<role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
</security-setting>
<address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" page-size-bytes="2097152" message-counter-history-day-limit="10" redistribution-delay="1000"/>
<http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>
<http-connector name="http-connector-throughput" socket-binding="http" endpoint="http-acceptor-throughput">
<param name="batch-delay" value="50"/>
</http-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>
<in-vm-acceptor name="in-vm" server-id="0"/>
<broadcast-group name="bg-group1" jgroups-channel="activemq-cluster" connectors="http-connector"/>
<discovery-group name="dg-group1" jgroups-channel="activemq-cluster"/>
<cluster-connection name="my-cluster" address="jms" connector-name="http-connector" discovery-group="dg-group1"/>
<jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
<jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
<jms-queue name="ali" entries="java:jboss/exported/jms/queue/ali"/>
<connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
<connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" retry-interval-multiplier="1.0" retry-interval="1000" client-failure-check-period="1000" failover-on-initial-connection="true" connectors="http-connector" ha="true" block-on-acknowledge="true" reconnect-attempts="5"/>
<pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa" reconnect-attempts="-1" block-on-acknowledge="true" ha="true" />
</server>
<server name="backup">
<security enabled="false"/>
<cluster password="sh@1396SM"/>
<replication-slave max-saved-replicated-journal-size="-1" group-name="group2" cluster-name="my-cluster">
<scale-down enabled="false"/>
</replication-slave>
<address-setting name="#" redistribution-delay="0" page-size-bytes="524288" max-size-bytes="1048576" max-delivery-attempts="200"/>
<remote-connector name="netty-backup" socket-binding="messaging-backup"/>
<in-vm-connector name="in-vm" server-id="0"/>
<remote-acceptor name="netty-backup" socket-binding="messaging-backup"/>
<broadcast-group name="bg-group-backup" connectors="netty-backup" broadcast-period="1000" jgroups-channel="activemq-cluster" jgroups-stack="udp"/>
<discovery-group name="dg-group-backup" refresh-timeout="1000" jgroups-channel="activemq-cluster" jgroups-stack="udp"/>
<cluster-connection name="my-cluster" discovery-group="dg-group-backup" retry-interval="1000" connector-name="netty-backup" address="jms"/>
</server>
</subsystem>
my slave config:
<subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0">
<server name="default">
<security enabled="false"/>
<cluster password="${jboss.messaging.cluster.password:sh@1396SM}"/>
<security-setting name="#">
<role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
</security-setting>
<address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" page-size-bytes="2097152" message-counter-history-day-limit="10" redistribution-delay="1000"/>
<http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>
<http-connector name="http-connector-throughput" socket-binding="http" endpoint="http-acceptor-throughput">
<param name="batch-delay" value="50"/>
</http-connector>
</connector>
<replication-master check-for-live-server="true" group-name="ali-server-group" cluster-name="my-cluster"/>
<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-connector name="netty-backup" socket-binding="messaging-backup"/>
<remote-acceptor name="netty-backup" socket-binding="messaging-backup"/>
<in-vm-acceptor name="in-vm" server-id="0"/>
<broadcast-group name="bg-group1" jgroups-channel="activemq-cluster" connectors="http-connector"/>
<discovery-group name="dg-group1" jgroups-channel="activemq-cluster"/>
<cluster-connection name="my-cluster" address="jms" connector-name="http-connector" discovery-group="dg-group1" failover-on-initial-connection="true"/>
<jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
<jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
<jms-queue name="ali" entries="java:jboss/exported/jms/queue/ali"/>
<connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
<connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" failover-on-initial-connection="true" client-failure-check-period="1000" connectors="http-connector" ha="true" retry-interval-multiplier="1.0" retry-interval="1000" block-on-acknowledge="true" reconnect-attempts="5"/>
<pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" reconnect-attempts="-1" block-on-acknowledge="true" ha="true" connectors="in-vm" transaction="xa" block-on-acknowledge="true" />
</server>
<server name="backup">
<security enabled="false"/>
<cluster password="sh@1396SM"/>
<replication-slave max-saved-replicated-journal-size="-1" group-name="group2" cluster-name="my-cluster">
<scale-down enabled="false"/>
</replication-slave>
<address-setting name="#" redistribution-delay="0" page-size-bytes="524288" max-size-bytes="1048576" max-delivery-attempts="200"/>
<remote-connector name="netty-backup" socket-binding="messaging-backup"/>
<in-vm-connector name="in-vm" server-id="0"/>
<remote-acceptor name="netty-backup" socket-binding="messaging-backup"/>
<broadcast-group name="bg-group-backup" connectors="netty-backup" broadcast-period="1000" jgroups-channel="activemq-cluster" jgroups-stack="udp"/>
<discovery-group name="dg-group-backup" refresh-timeout="1000" jgroups-channel="activemq-cluster" jgroups-stack="udp"/>
<cluster-connection name="my-cluster" discovery-group="dg-group-backup" retry-interval="1000" connector-name="netty-backup" address="jms"/>
</server>
</subsystem>
my client code:
InitialContext initialContext = null;
Connection connectionA = null;
try {
final Properties props = new Properties();
props.put("java.naming.factory.initial",
"org.jboss.naming.remote.client.InitialContextFactory");
props.put("java.naming.provider.url",
"http-remoting://192.168.0.200:8330,http-remoting://192.168.0.201:8330");
props.put(Context.SECURITY_PRINCIPAL, "isc");
// password
props.put(Context.SECURITY_CREDENTIALS, "sh@1396SM");
// Step 1. Get an initial context for looking up JNDI from server 0
initialContext = new InitialContext(props);
// Step 2. Look-up the JMS Queue object from JNDI
// Step 3. Look-up a JMS Connection Factory object from JNDI on server 0
ConnectionFactory connectionFactory = (ConnectionFactory) initialContext.lookup("jms/RemoteConnectionFactory");
((ActiveMQConnectionFactory)connectionFactory).setInitialConnectAttempts(20);
((ActiveMQConnectionFactory)connectionFactory).setFailoverOnInitialConnection(true);
// Step 4. We create 1 JMS connections from the same connection factory.
// Wait a little while to make sure broadcasts from all nodes have reached the client
// Thread.sleep(5000);
connectionA = connectionFactory.createConnection();
((ActiveMQConnection) connectionA).setFailoverListener(new FailoverListenerImpl());
// Step 5. We create JMS Sessions
Session sessionA = connectionA.createSession(false, Session.AUTO_ACKNOWLEDGE);
Queue queue = (Queue) initialContext.lookup("jms/queue/ali");
// Step 6. We create JMS MessageProducer objects on the sessions
MessageProducer producerA = sessionA.createProducer(queue);
// Step 7. We send some messages on each producer
final int numMessages = 10000000;
for (int i = 0; i < numMessages; i++) {
TextMessage messageA = sessionA.createTextMessage("A:This is text message " + i);
producerA.send(messageA);
System.out.println("Sent message: " + messageA.getText());
}
// Step 8. We start the connection to consume messages
connectionA.start();
} finally {
// Step 10. Be sure to close our resources!
if (connectionA != null) {
connectionA.close();
}
if (initialContext != null) {
initialContext.close();
}
}