Hi Justin,
Thanks a lot for your input. We tried setting up the core bridge and were successful in setting one in Hornetq 2.2.5 with the forwarding address queue in Hornetq 2.4.0.
But we are having issues with the reverse test case – setting up the bridge in Hornetq 2.4.0 and forwarding queue in Hornetq 2.2.5.
The configuration snippets in Hornetq2.4.0 is as follows:
Hornetq-configuration.xml (2.4.0)
<connectors>
<connector name="netty">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
<param key="port" value="${hornetq.remoting.netty.port:5449}"/>
</connector>
<connector name="netty-throughput">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
<param key="port" value="${hornetq.remoting.netty.batch.port:5459}"/>
<param key="batch-delay" value="50"/>
</connector>
<!-- Connector to the other node -->
<connector name="remote-connector">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key="port" value="5445"/>
</connector>
</connectors>
<acceptors>
<acceptor name="netty">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
<param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
<param key="port" value="${hornetq.remoting.netty.port:5449}"/>
</acceptor>
<acceptor name="netty-throughput">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
<param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
<param key="port" value="${hornetq.remoting.netty.batch.port:5459}"/>
<param key="batch-delay" value="50"/>
<param key="direct-deliver" value="false"/>
</acceptor>
</acceptors>
<!-- We need to create a core queue for the JMS queue explicitly because the bridge will be deployed
before the JMS queue is deployed, so the first time, it otherwise won't find the queue -->
<queues>
<queue name="jms.queue.sausage-factory">
<address>jms.queue.sausage-factory</address>
</queue>
</queues>
<!-- We set-up a bridge that forwards from a queue on this node to an address on another node.
We specify a filter with the bridge, and a transformer too. The filter and transformer are optional -->
<bridges>
<bridge name="my-bridge">
<queue-name>jms.queue.sausage-factory</queue-name>
<forwarding-address>jms.queue.mincing-machine</forwarding-address>
<reconnect-attempts>10</reconnect-attempts>
<static-connectors>
<connector-ref>remote-connector</connector-ref>
</static-connectors>
</bridge>
</bridges>
Hornetq-jms.xml (2.4.0)
<connection-factory name="NettyConnectionFactory">
<xa>false</xa>
<connectors>
<connector-ref connector-name="netty"/>
</connectors>
<entries>
<entry name="/ConnectionFactory"/>
</entries>
</connection-factory>
<connection-factory name="NettyThroughputConnectionFactory">
<xa>true</xa>
<connectors>
<connector-ref connector-name="netty-throughput"/>
</connectors>
<entries>
<entry name="/XAThroughputConnectionFactory"/>
</entries>
</connection-factory>
<connection-factory name="NettyThroughputConnectionFactory">
<xa>false</xa>
<connectors>
<connector-ref connector-name="netty-throughput"/>
</connectors>
<entries>
<entry name="/ThroughputConnectionFactory"/>
</entries>
</connection-factory>
<connection-factory name="ClientConnectionFactory">
<connectors>
<connector-ref connector-name="netty"/>
</connectors>
<entries>
<entry name="/client/ConnectionFactory"/>
</entries>
</connection-factory>
<!--the connection factory used by the example-->
<connection-factory name="ConnectionFactory">
<connectors>
<connector-ref connector-name="netty"/>
</connectors>
<entries>
<entry name="ConnectionFactory1"/>
</entries>
</connection-factory>
<queue name="DLQ">
<entry name="/queue/DLQ"/>
</queue>
<queue name="ExpiryQueue">
<entry name="/queue/ExpiryQueue"/>
</queue>
<!--the queue used by the example-->
<queue name="sausage-factory">
<entry name="/queue/sausage-factory"/>
</queue>
Similarly in 2.2.5, the configurations are:
Hornetq-configurations.xml
<connectors>
<connector name="netty">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
<param key="port" value="${hornetq.remoting.netty.port:5445}"/>
</connector>
<connector name="netty-throughput">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
<param key="port" value="${hornetq.remoting.netty.batch.port:5455}"/>
<param key="batch-delay" value="50"/>
</connector>
</connectors>
<acceptors>
<acceptor name="netty">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
<param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
<param key="port" value="${hornetq.remoting.netty.port:5445}"/>
</acceptor>
<acceptor name="netty-throughput">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
<param key="host" value="${hornetq.remoting.netty.host:localhost}"/>
<param key="port" value="${hornetq.remoting.netty.batch.port:5455}"/>
<param key="batch-delay" value="50"/>
<param key="direct-deliver" value="false"/>
</acceptor>
</acceptors>
Hornet-jms.xml (2.2.5)
<connection-factory name="NettyConnectionFactory">
<xa>true</xa>
<connectors>
<connector-ref connector-name="netty"/>
</connectors>
<entries>
<entry name="/XAConnectionFactory"/>
</entries>
</connection-factory>
<connection-factory name="NettyConnectionFactory">
<xa>false</xa>
<connectors>
<connector-ref connector-name="netty"/>
</connectors>
<entries>
<entry name="/ConnectionFactory"/>
</entries>
</connection-factory>
<connection-factory name="NettyThroughputConnectionFactory">
<xa>true</xa>
<connectors>
<connector-ref connector-name="netty-throughput"/>
</connectors>
<entries>
<entry name="/XAThroughputConnectionFactory"/>
</entries>
</connection-factory>
<connection-factory name="NettyThroughputConnectionFactory">
<xa>false</xa>
<connectors>
<connector-ref connector-name="netty-throughput"/>
</connectors>
<entries>
<entry name="/ThroughputConnectionFactory"/>
</entries>
</connection-factory>
<!--the queue used by the example-->
<queue name="mincing-machine">
<entry name="/queue/mincing-machine"/>
</queue>
I am able to start both servers. After a while, I see this message in the hornet-2.4.0 console:
INFO [org.hornetq.core.server] HQ221003: trying to deploy queue jms.queue.sausage-factory
INFO [org.hornetq.core.server] HQ221003: trying to deploy queue jms.queue.DLQ
INFO [org.hornetq.core.server] HQ221003: trying to deploy queue jms.queue.ExpiryQueue
INFO [org.hornetq.core.server] HQ221003: trying to deploy queue jms.queue.sausage-factory
INFO [org.hornetq.core.server] HQ221020: Started Netty Acceptor version 4.0.13.Final localhost:5459
INFO [org.hornetq.core.server] HQ221020: Started Netty Acceptor version 4.0.13.Final localhost:5449
WARN [org.hornetq.core.server] HQ222171: Bridge my-bridge forwarding address jms.queue.mincing-machine could not be resolved on address-settings configuration
INFO [org.hornetq.core.server] HQ221007: Server is now live
INFO [org.hornetq.core.server] HQ221001: HornetQ Server version 2.5.0.SNAPSHOT (Wild Hornet, 124) [fac29d9c-23bd-11e9-aac4-8955a5d2568b]
WARNING [io.netty.channel.AbstractChannel] 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:703) [netty.jar:4.0.13.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor.addTask(SingleThreadEventExecutor.java:296) [netty.jar:4.0.13.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor.execute(SingleThreadEventExecutor.java:688) [netty.jar:4.0.13.Final]
at io.netty.channel.AbstractChannel$AbstractUnsafe.invokeLater(AbstractChannel.java:727) [netty.jar:4.0.13.Final]
at io.netty.channel.AbstractChannel$AbstractUnsafe.close(AbstractChannel.java:557) [netty.jar:4.0.13.Final]
at io.netty.channel.DefaultChannelPipeline$HeadHandler.close(DefaultChannelPipeline.java:1018) [netty.jar:4.0.13.Final]
I came across: https://issues.jboss.org/browse/HORNETQ-1312 - which seems to indicate that the issue happens during stress to the system. I got them even before attempting to send any messages. I also made sure to kill any hornetq processes before repeating the test. Can you please provide your inputs on why the above could have happened?
Similarly, after HornetQ 2.2.5 starts up, I see this in the console:
INFO [org.hornetq.core.server.impl.HornetQServerImpl] trying to deploy queue jms.queue.DLQ
INFO [org.hornetq.core.server.impl.HornetQServerImpl] trying to deploy queue jms.queue.ExpiryQueue
INFO [org.hornetq.core.server.impl.HornetQServerImpl] trying to deploy queue jms.queue.mincing-machine
INFO [org.hornetq.core.remoting.impl.netty.NettyAcceptor] Started Netty Acceptor version 3.2.3.Final-r${buildNumber} localhost:5445 for CORE protocol
INFO [org.hornetq.core.remoting.impl.netty.NettyAcceptor] Started Netty Acceptor version 3.2.3.Final-r${buildNumber} localhost:5455 for CORE protocol
INFO [org.hornetq.core.server.impl.HornetQServerImpl] Server is now live
INFO [org.hornetq.core.server.impl.HornetQServerImpl] HornetQ Server version 2.2.5.Final (HQ_2_2_5_FINAL_AS7, 121) [cff16942-2053-11e9-b690-fa163e83fad6] started
WARNING [org.hornetq.core.protocol.core.impl.RemotingConnectionImpl] Connection failure has been detected: Did not receive data from /127.0.0.1:33927. It is likely the client has exited or crashed without closing its connection, or the network between the server and client has failed. You also might have configured connection-ttl and client-failure-check-period incorrectly. Please check user manual for more information. The connection will now be closed. [code=3]
WARNING [org.hornetq.core.protocol.core.impl.RemotingConnectionImpl] Connection failure has been detected: Did not receive data from /127.0.0.1:33934. It is likely the client has exited or crashed without closing its connection, or the network between the server and client has failed. You also might have configured connection-ttl and client-failure-check-period incorrectly. Please check user manual for more information. The connection will now be closed. [code=3]
I am not sure if the above is due to stress to the system, please let me know what could have caused it.
After the above, I tried to run a modified version of 2.4.0 jms/bridge example. I commented out the steps to start the servers, since I had already done so. So just ran the portions that look up the connection, queues and produce the message, send and then consume the message. This failed while trying to create Connection in Hornetq 2.2.5 with the following exception:
INFO: using jnp://localhost:1100 for jndi
ConnectionFactory0 - which is HQ2.4.0 - HornetQConnectionFactory [serverLocator=ServerLocatorImpl [initialConnectors=[TransportConfiguration(name=netty, factory=org-hornetq-core-remoting-impl-netty-NettyConnectorFactory) ?port=5449&host=localhost], discoveryGroupConfiguration=null], clientID=null, consumerWindowSize = 1048576, dupsOKBatchSize=1048576, transactionBatchSize=1048576, readOnly=false]
- org.hornetq.common.example.HornetQExample getContext
INFO: using jnp://localhost:1099 for jndi
** Sent message: MESSAGE: Test message sent at 1549370916428 node 0
ConnectionFactory1 - which is HQ2.2.5 - HornetQConnectionFactory [serverLocator=ServerLocatorImpl [initialConnectors=[TransportConfiguration(name=netty, factory=org-hornetq-core-remoting-impl-netty-NettyConnectorFactory) ?port=5445&host=localhost], discoveryGroupConfiguration=null], clientID=null, consumerWindowSize = 1048576, dupsOKBatchSize=1048576, transactionBatchSize=1048576, readOnly=false]
- javax.jms.JMSException: Failed to create session factory
at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:676)
at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:115)
at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:110)
at org.hornetq.jms.example.BridgeExample.runExample(BridgeExample.java:103)
at org.hornetq.common.example.HornetQExample.run(HornetQExample.java:70)
<snip>
Caused by: java.lang.NullPointerException
at org.hornetq.core.client.impl.ServerLocatorImpl.assertOpen(ServerLocatorImpl.java:2035)
at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:831)
at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:672)
... 31 more
I am not sure if the above is expected after Hornetq 2.2.5 console had this message:
WARNING [org.hornetq.core.protocol.core.impl.RemotingConnectionImpl] Connection failure has been detected: Did not receive data from /127.0.0.1:33934. It is likely the client has exited or crashed without closing its connection, or the network between the server and client has failed. You also might have configured connection-ttl and client-failure-check-period incorrectly. Please check user manual for more information. The connection will now be closed. [code=3]
Please let me know if I have missed anything in config or potentially if it’s a code issue.
Thanks
Ram