Hi
I have same problem but I can't solve problem with your solution , my client thrown exception as below
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 config as below:
master config:
<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" discovery-group="dg-group1" 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>
my slave config as below:
<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" discovery-group="dg-group1" 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 as below:
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();
}
}