reconnect to remote hornetq cluster does not work
mko0815 Sep 19, 2012 5:07 AMHi,
we are currently using jboss 7.1.2
our setup is as follows:
1 cluster of 3 nodes, where our ear application is deployed
1 cluster of 2 nodes where JMS is configured
both clusterd are managed by 1 domain controller.
now the app cluster should use the jms cluster for messaging.
the app consitst of producers who will write to jms queue, this producers get the jms connection from jndi.
and as second there are MDBs which are listen to queues on the remote cluster.
if the all nodes are up, the messaging for producers works fine, thy can put messages to the cluster.
but the MDBs do not listen to the cluster, they just listen to 1 node of JMS cluster, so if message send to frist node MDBs receive it, if message arrives on second node MDBs will not receive it.
and as second problem
when i shutdown the first node from jms cluster, the jms connection gets lost.
for the producer i can hanle it, by just checking if the connection is alive, if doesn't i can create a new connection.
but for MDBs they will fail, they completly lost the connection.
from exception point it looks like the MDBs are not connected to the cluster, instead they are just connected to the first node, even if i restart the first node, the MDBs can't reconnect.
here is how i configured the JMS Nodes:
{code:xml}
<subsystem xmlns="urn:jboss:domain:messaging:1.3">
<hornetq-server>
<clustered>true</clustered>
<persistence-enabled>true</persistence-enabled>
<security-enabled>false</security-enabled>
<cluster-user>1234</cluster-user>
<cluster-password>1234</cluster-password>
<journal-file-size>102400</journal-file-size>
<journal-min-files>2</journal-min-files>
<connectors>
<netty-connector name="netty" socket-binding="messaging"/>
</connectors>
<acceptors>
<netty-acceptor name="netty" socket-binding="messaging"/>
</acceptors>
<broadcast-groups>
<broadcast-group name="bg-group1">
<socket-binding>messaging-group</socket-binding>
<broadcast-period>5000</broadcast-period>
<connector-ref>
netty
</connector-ref>
</broadcast-group>
</broadcast-groups>
<discovery-groups>
<discovery-group name="dg-group1">
<socket-binding>messaging-group</socket-binding>
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups>
<cluster-connections>
<cluster-connection name="my-cluster">
<address>jms</address>
<connector-ref>netty</connector-ref>
<retry-interval>500</retry-interval>
<use-duplicate-detection>true</use-duplicate-detection>
<forward-when-no-consumers>true</forward-when-no-consumers>
<max-hops>1</max-hops>
<discovery-group-ref discovery-group-name="dg-group1"/>
</cluster-connection>
</cluster-connections>
<address-settings>
<address-setting match="jms.queue.MessageQueue">
<dead-letter-address>jms.queue.DLQ</dead-letter-address>
<expiry-address>jms.queue.ExpiryQueue</expiry-address>
<max-size-bytes>419430400</max-size-bytes>
<address-full-policy>PAGE</address-full-policy>
<redistribution-delay>-1</redistribution-delay>
</address-setting>
<address-setting match="#">
<dead-letter-address>jms.queue.DLQ</dead-letter-address>
<expiry-address>jms.queue.ExpiryQueue</expiry-address>
<max-size-bytes>209715200</max-size-bytes>
<address-full-policy>PAGE</address-full-policy>
<redistribution-delay>500</redistribution-delay>
</address-setting>
</address-settings>
<jms-destinations>
<jms-queue name="testQueue">
<entry name="queue/test"/>
<entry name="java:jboss/exported/jms/queue/test"/>
</jms-queue>
<jms-topic name="testTopic">
<entry name="topic/test"/>
<entry name="java:jboss/exported/jms/topic/test"/>
</jms-topic>
</jms-destinations>
</hornetq-server>
</subsystem>
{code}
and here is the config for the application nodes:
{code:xml}
<subsystem xmlns="urn:jboss:domain:messaging:1.3">
<hornetq-server>
<discovery-groups>
<discovery-group name="dg-group-test1">
<socket-binding>remote-messaging-group</socket-binding>
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups>
<jms-connection-factories>
<connection-factory name="hornetq-ra-cluster">
<discovery-group-ref discovery-group-name="dg-group-test1"/>
<entries>
<entry name="java:/ConnectionFactory"/>
<entry name="java:jboss/exported/jms/ConnectionFactory"/>
</entries>
</connection-factory>
<pooled-connection-factory name="hornetq-ra">
<user>1234</user>
<password>1234</password>
<transaction mode="xa"/>
<discovery-group-ref discovery-group-name="dg-group-test1"/>
<entries>
<entry name="java:/JmsXA"/>
</entries>
</pooled-connection-factory>
</jms-connection-factories>
<jms-destinations>
<jms-queue name="testQueue">
<entry name="queue/test"/>
<entry name="java:jboss/exported/jms/queue/test"/>
</jms-queue>
<jms-topic name="testTopic">
<entry name="topic/test"/>
<entry name="java:jboss/exported/jms/topic/test"/>
</jms-topic>
</jms-destinations>
</hornetq-server>
</subsystem>
{code}
the exception we got after we shutdown one node is the following;
{code}
[Server:integration-server-one] 11:02:25,040 WARN [org.hornetq.jms.server.recovery.HornetQXAResourceWrapper] (Periodic Recovery) Can't connect to XARecoveryConfig [transportConfiguration = [org-hornetq-core-remoting-impl-netty-
ettyConnectorFactory?port=6445&host=www-localhost], discoveryConfiguration = null, username=1234, password=1234] on auto-generated resource recovery: HornetQException[errorCode=2 message=Cannot connect to server(s). Tried
with all available servers.]
[Server:integration-server-one] at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:774) [hornetq-core-2.2.16.Final.jar:2.2.16.Final (HQ_2_2_16_FINAL, 122)]
[Server:integration-server-one] at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.connect(HornetQXAResourceWrapper.java:347) [hornetq-jms-2.2.16.Final.jar:2.2.16.Final (HQ_2_2_16_FINAL, 122)]
[Server:integration-server-one] at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.getDelegate(HornetQXAResourceWrapper.java:262) [hornetq-jms-2.2.16.Final.jar:2.2.16.Final (HQ_2_2_16_FINAL, 122)]
[Server:integration-server-one] at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.isSameRM(HornetQXAResourceWrapper.java:147) [hornetq-jms-2.2.16.Final.jar:2.2.16.Final (HQ_2_2_16_FINAL, 122)]
[Server:integration-server-one] at com.arjuna.ats.internal.jta.recovery.arjunacore.RecoveryXids.isSameRM(RecoveryXids.java:131) [jbossjts-4.16.4.Final.jar:]
[Server:integration-server-one] at com.arjuna.ats.internal.jta.recovery.arjunacore.RecoveryXids.updateIfEquivalentRM(RecoveryXids.java:185) [jbossjts-4.16.4.Final.jar:]
[Server:integration-server-one] at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.refreshXidScansForEquivalentXAResourceImpl(XARecoveryModule.java:752) [jbossjts-4.16.4.Final.jar:]
[Server:integration-server-one] at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.xaRecovery(XARecoveryModule.java:532) [jbossjts-4.16.4.Final.jar:]
[Server:integration-server-one] at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.resourceInitiatedRecoveryForRecoveryHelpers(XARecoveryModule.java:471) [jbossjts-4.16.4.Final.jar:]
[Server:integration-server-one] at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.bottomUpRecovery(XARecoveryModule.java:385) [jbossjts-4.16.4.Final.jar:]
[Server:integration-server-one] at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.periodicWorkSecondPass(XARecoveryModule.java:166) [jbossjts-4.16.4.Final.jar:]
[Server:integration-server-one] at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.doWorkInternal(PeriodicRecovery.java:789) [jbossjts-4.16.4.Final.jar:]
[Server:integration-server-one] at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.run(PeriodicRecovery.java:371) [jbossjts-4.16.4.Final.jar:]
{code}
from this exception it look like that the MDBs dont realy use the cluster configurtion :--> discoveryConfiguration = null
did someone have any idea what we make wrong ?
thanks for help
kr Matthias