HQ 2.2.13 - Cannot seem to set up MDB with failover using hard coded list of hosts
ndipiazza Aug 15, 2012 5:15 PMThis question is related to: https://community.jboss.org/message/753626
We have seen this same problem in both JBoss 7.1.1.Final (HornetQ 2.2.13), but we also verified it happens in 7.1.2.Final (HornetQ 2.2.16) as well. For now, we continue testing on Jboss 7.1.1.Final.
Summary of the issue
MDB HornetQ Client cannot seem to subscribe to any more than one HornetQ Server. When attempting to connect to more than one, fails in a loop.
We can get this to work with a single node in the connection list, and we can get failover to work if we use a standalone java client using the HQ client API.
More details and steps to reproduce
We have a topic "ndipiazza.pl.testing" deployed on a JBoss HornetQ cluster with 2 nodes - each deployed using standalone-full-ha.xml.
Here is the messaging subsystem for one of the HornetQ server nodes:
<subsystem xmlns="urn:jboss:domain:messaging:1.1">
<hornetq-server>
<clustered>true</clustered>
<security-enabled>false</security-enabled>
<persistence-enabled>true</persistence-enabled>
<journal-file-size>102400</journal-file-size>
<journal-min-files>2</journal-min-files>
<connectors>
<netty-connector name="netty" socket-binding="messaging" />
<netty-connector name="netty-throughput"
socket-binding="messaging-throughput">
<param key="batch-delay" value="50" />
</netty-connector>
<in-vm-connector name="in-vm" server-id="0" />
</connectors>
<acceptors>
<netty-acceptor name="netty" socket-binding="messaging" />
<netty-acceptor name="netty-throughput"
socket-binding="messaging-throughput">
<param key="batch-delay" value="50" />
<param key="direct-deliver" value="false" />
</netty-acceptor>
<in-vm-acceptor name="in-vm" server-id="0" />
</acceptors>
<broadcast-groups>
<broadcast-group name="bg-group1">
<group-address>231.7.7.7</group-address>
<group-port>9876</group-port>
<broadcast-period>5000</broadcast-period>
<connector-ref>netty</connector-ref>
</broadcast-group>
</broadcast-groups>
<discovery-groups>
<discovery-group name="dg-group1">
<group-address>231.7.7.7</group-address>
<group-port>9876</group-port>
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups>
<cluster-connections>
<cluster-connection name="my-cluster">
<address>jms</address>
<connector-ref>netty</connector-ref>
<discovery-group-ref discovery-group-name="dg-group1" />
</cluster-connection>
</cluster-connections>
<security-settings>
<security-setting match="#">
<permission type="send" roles="guest" />
<permission type="consume" roles="guest" />
<permission type="createNonDurableQueue" roles="guest" />
<permission type="deleteNonDurableQueue" roles="guest" />
</security-setting>
</security-settings>
<address-settings>
<!--default for catch all -->
<address-setting match="#">
<dead-letter-address>jms.queue.DLQ</dead-letter-address>
<expiry-address>jms.queue.ExpiryQueue</expiry-address>
<redelivery-delay>0</redelivery-delay>
<redistribution-delay>1000</redistribution-delay>
<max-size-bytes>10485760</max-size-bytes>
<address-full-policy>BLOCK</address-full-policy>
<message-counter-history-day-limit>10</message-counter-history-day-limit>
</address-setting>
</address-settings>
<jms-connection-factories>
<connection-factory name="InVmConnectionFactory">
<connectors>
<connector-ref connector-name="in-vm" />
</connectors>
<entries>
<entry name="java:/ConnectionFactory" />
</entries>
</connection-factory>
<connection-factory name="RemoteConnectionFactory">
<connectors>
<connector-ref connector-name="netty" />
</connectors>
<entries>
<entry name="RemoteConnectionFactory" />
<entry name="java:jboss/exported/jms/RemoteConnectionFactory" />
</entries>
<ha>true</ha>
</connection-factory>
<pooled-connection-factory name="hornetq-ra">
<transaction mode="xa" />
<connectors>
<connector-ref connector-name="in-vm" />
</connectors>
<entries>
<entry name="java:/JmsXA" />
</entries>
</pooled-connection-factory>
</jms-connection-factories>
<jms-destinations>
<jms-topic name="ndipiazza.pl.testing">
<entry name="ndipiazza.pl.testing" />
<entry name="java:jboss/exported/ndipiazza.pl.testing" />
</jms-topic>
</jms-destinations>
</hornetq-server>
</subsystem>
If we setup a Standalone Java client using the HornetQ client API, we are able to subscribe to the topic as well as failover between the two nodes. This works great.
But what we really want is an MDB defined on a 3rd JBoss 7.1.1.Final server that is acting as the HornetQ JMS client.
This uses standalone-full-ha.xml and here is the messaging subsystem on this node:
<subsystem xmlns="urn:jboss:domain:messaging:1.1">
<hornetq-server>
<persistence-enabled>true</persistence-enabled>
<security-enabled>false</security-enabled>
<journal-file-size>102400</journal-file-size>
<journal-min-files>2</journal-min-files>
<connectors>
<connector name="remote-jmsxa1">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory
</factory-class>
<param key="host" value="192.168.16.129" />
<param key="port" value="5445" />
</connector>
<connector name="remote-jmsxa2">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory
</factory-class>
<param key="host" value="192.168.19.175" />
<param key="port" value="5445" />
</connector>
<netty-connector name="netty" socket-binding="messaging" />
<netty-connector name="netty-throughput"
socket-binding="messaging-throughput">
<param key="batch-delay" value="50" />
</netty-connector>
<in-vm-connector name="in-vm" server-id="0" />
</connectors>
<acceptors>
<netty-acceptor name="netty" socket-binding="messaging" />
<netty-acceptor name="netty-throughput"
socket-binding="messaging-throughput">
<param key="batch-delay" value="50" />
<param key="direct-deliver" value="false" />
</netty-acceptor>
<in-vm-acceptor name="in-vm" server-id="0" />
</acceptors>
<broadcast-groups>
<broadcast-group name="bg-group1">
<group-address>231.7.7.7</group-address>
<group-port>9876</group-port>
<broadcast-period>5000</broadcast-period>
<connector-ref>
netty
</connector-ref>
</broadcast-group>
</broadcast-groups>
<discovery-groups>
<discovery-group name="dg-group1">
<group-address>231.7.7.7</group-address>
<group-port>9876</group-port>
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups>
<cluster-connections>
<cluster-connection name="my-cluster">
<address>jms</address>
<connector-ref>netty</connector-ref>
<discovery-group-ref discovery-group-name="dg-group1" />
</cluster-connection>
</cluster-connections>
<security-settings>
<security-setting match="#">
<permission type="send" roles="guest" />
<permission type="consume" roles="guest" />
<permission type="createNonDurableQueue" roles="guest" />
<permission type="deleteNonDurableQueue" roles="guest" />
</security-setting>
</security-settings>
<address-settings>
<address-setting match="#">
<dead-letter-address>jms.queue.DLQ</dead-letter-address>
<expiry-address>jms.queue.ExpiryQueue</expiry-address>
<redelivery-delay>0</redelivery-delay>
<max-size-bytes>10485760</max-size-bytes>
<address-full-policy>BLOCK</address-full-policy>
<message-counter-history-day-limit>10
</message-counter-history-day-limit>
<redistribution-delay>1000</redistribution-delay>
</address-setting>
</address-settings>
<jms-connection-factories>
<connection-factory name="InVmConnectionFactory">
<connectors>
<connector-ref connector-name="in-vm" />
</connectors>
<entries>
<entry name="java:/ConnectionFactory" />
</entries>
</connection-factory>
<connection-factory name="RemoteConnectionFactory">
<connectors>
<connector-ref connector-name="netty" />
</connectors>
<entries>
<entry name="RemoteConnectionFactory" />
<entry name="java:jboss/exported/jms/RemoteConnectionFactory" />
</entries>
</connection-factory>
<pooled-connection-factory name="hornetq-ra">
<transaction mode="xa" />
<connectors>
<connector-ref connector-name="remote-jmsxa1" />
<connector-ref connector-name="remote-jmsxa2" />
</connectors>
<entries>
<entry name="java:/JmsXA" />
</entries>
<ha>true</ha>
</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>
Here is the MDB's ejb-jar.xml (we are not using the MDB annotations at this time):
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC
'-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN'
'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
<ejb-jar>
<enterprise-beans>
<message-driven>
<ejb-name>TestMDB</ejb-name>
<ejb-class>test.mdb.TestMDB</ejb-class>
<transaction-type>Container</transaction-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Topic</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>ndipiazza.pl.testing</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>hA</activation-config-property-name>
<activation-config-property-value>true</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>connectionParameters</activation-config-property-name>
<activation-config-property-value>host=192.168.16.129;port=5445,host=192.168.19.175;port=5445</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>connectorClassName</activation-config-property-name>
<activation-config-property-value>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory,org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
</enterprise-beans>
</ejb-jar>
The MDB's java code is attached, but there isn't much to see there.
The problem is... the MDB is never able to connect to either host. The log attached is from the MDB client server from when this is happening with Jboss 7.1.1.Final where logging on org.hornetq.ra is set to DEBUG.
Once again, this WORKS if you simply specify only one host/port in connectionParameters and one connectorClassName.
Basically, the following happens in a loop endlessly.
11:57:51,010 DEBUG [org.hornetq.ra.inflow.HornetQActivation] (default-short-running-threads-threads - 1) Setting up org.hornetq.ra.inflow.HornetQActivationSpec(ra=org.hornetq.ra.HornetQResourceAdapter@2e91cb6 destination=ndipiazza.pl.testing destinationType=javax.jms.Topic ack=Auto-acknowledge durable=false clientID=null user=null maxSession=15)
11:57:51,011 DEBUG [org.hornetq.ra.HornetQResourceAdapter] (default-short-running-threads-threads - 1) Creating Connection Factory on the resource adapter for transport=[Lorg.hornetq.api.core.TransportConfiguration;@2adb2c53 with ha=true
11:57:51,012 DEBUG [org.hornetq.ra.recovery.RecoveryManager] (default-short-running-threads-threads - 1) registering recovery for factory : HornetQConnectionFactory [serverLocator=ServerLocatorImpl [initialConnectors=[org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=192-168-16-129, org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=192-168-19-175], discoveryGroupConfiguration=null], clientID=null, dupsOKBatchSize=1048576, transactionBatchSize=1048576, readOnly=false]
11:57:51,016 DEBUG [org.hornetq.ra.inflow.HornetQActivation] (default-short-running-threads-threads - 1) Using context {java.naming.factory.url.pkgs=org.jboss.as.naming.interfaces:org.jboss.ejb.client.naming} for org.hornetq.ra.inflow.HornetQActivationSpec(ra=org.hornetq.ra.HornetQResourceAdapter@2e91cb6 destination=ndipiazza.pl.testing destinationType=javax.jms.Topic ack=Auto-acknowledge durable=false clientID=null user=null maxSession=15)
11:57:51,017 DEBUG [org.hornetq.ra.inflow.HornetQActivation] (default-short-running-threads-threads - 1) Destination type defined as javax.jms.Topic
11:57:51,018 DEBUG [org.hornetq.ra.inflow.HornetQActivation] (default-short-running-threads-threads - 1) Retrieving destination ndipiazza.pl.testing of type javax.jms.Topic
11:57:51,019 DEBUG [org.hornetq.ra.inflow.HornetQActivation] (default-short-running-threads-threads - 1) Got destination HornetQTopic[ndipiazza.pl.testing] from ndipiazza.pl.testing
11:57:51,075 DEBUG [org.hornetq.ra.HornetQResourceAdapter] (default-short-running-threads-threads - 1) Using queue connection DelegatingSession [session=ClientSessionImpl [name=f252f06b-e641-11e1-b09d-209e20524153, username=null, closed=false, factory = ClientSessionFactoryImpl [serverLocator=ServerLocatorImpl [initialConnectors=[org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=192-168-16-129, org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=192-168-19-175], discoveryGroupConfiguration=null], connectorConfig=org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=192-168-19-175, backupConfig=null], metaData=()]@2228d689]
11:57:51,086 DEBUG [org.hornetq.ra.inflow.HornetQActivation] (default-short-running-threads-threads - 1) Using queue connection DelegatingSession [session=ClientSessionImpl [name=f252f06b-e641-11e1-b09d-209e20524153, username=null, closed=false, factory = ClientSessionFactoryImpl [serverLocator=ServerLocatorImpl [initialConnectors=[org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=192-168-16-129, org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=192-168-19-175], discoveryGroupConfiguration=null], connectorConfig=org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=192-168-19-175, backupConfig=null], metaData=(resource-adapter=inbound,jms-session=,)]@2228d689]
11:57:51,096 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "eService.ear"
11:57:51,116 DEBUG [org.hornetq.ra.HornetQResourceAdapter] (default-short-running-threads-threads - 1) Using queue connection DelegatingSession [session=ClientSessionImpl [name=f25a918c-e641-11e1-b09d-209e20524153, username=null, closed=false, factory = ClientSessionFactoryImpl [serverLocator=ServerLocatorImpl [initialConnectors=[org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=192-168-16-129, org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=192-168-19-175], discoveryGroupConfiguration=null], connectorConfig=org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=usdhgupta-ndipiazza-na, backupConfig=null], metaData=()]@307975b6]
11:57:51,121 DEBUG [org.hornetq.ra.inflow.HornetQActivation] (default-short-running-threads-threads - 1) Using queue connection DelegatingSession [session=ClientSessionImpl [name=f25a918c-e641-11e1-b09d-209e20524153, username=null, closed=false, factory = ClientSessionFactoryImpl [serverLocator=ServerLocatorImpl [initialConnectors=[org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=192-168-16-129, org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=192-168-19-175], discoveryGroupConfiguration=null], connectorConfig=org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=usdhgupta-ndipiazza-na, backupConfig=null], metaData=(resource-adapter=inbound,jms-session=,)]@307975b6]
11:57:51,128 INFO [org.hornetq.ra.inflow.HornetQActivation] (default-short-running-threads-threads - 1) awaiting topic/queue creation ndipiazza.pl.testing
11:57:51,129 DEBUG [org.hornetq.ra.inflow.HornetQActivation] (default-short-running-threads-threads - 1) Tearing down org.hornetq.ra.inflow.HornetQActivationSpec(ra=org.hornetq.ra.HornetQResourceAdapter@2e91cb6 destination=ndipiazza.pl.testing destinationType=javax.jms.Topic ack=Auto-acknowledge durable=false clientID=null user=null maxSession=15)
11:57:51,170 DEBUG [org.hornetq.ra.inflow.HornetQActivation] (default-short-running-threads-threads - 1) Tearing down complete org.hornetq.ra.inflow.HornetQActivation(spec=org.hornetq.ra.inflow.HornetQActivationSpec mepf=org.jboss.as.ejb3.inflow.JBossMessageEndpointFactory active=true destination=ndipiazza.pl.testing transacted=true)
11:57:53,171 INFO [org.hornetq.ra.inflow.HornetQActivation] (default-short-running-threads-threads - 1) Attempting to reconnect org.hornetq.ra.inflow.HornetQActivationSpec(ra=org.hornetq.ra.HornetQResourceAdapter@2e91cb6 destination=ndipiazza.pl.testing destinationType=javax.jms.Topic ack=Auto-acknowledge durable=false clientID=null user=null maxSession=15)
Any help would be appreciated!!!
-Nicholas
Message was edited by: Nicholas DiPiazza Removed useless logs added to ticket initially. Added hornetq-failover-issue.zip which has all details needed.
-
hornetq-failover-issue.zip 131.2 KB