Need more info on how clustering works
chriswilliams May 8, 2012 2:12 PMWe've got two applications A and B. Each app is running on a different physical server. Each app defines the same queue and only app B has a consumer that reads from that queue. Both apps A and B write to the queue.
We've tried a number of configurations to get the queue writes from app A to go to the queue that lives on server B so the consumer from app B can read from that queue and perform whatever work needs to be done in response.
We do see the servers sync up and the cluster connection establish when the second server starts (regardless of which one starts first):
12:46:05,312 INFO [org.hornetq.core.server.cluster.impl.BridgeImpl] (Thread-1 (HornetQ-server-HornetQServerImpl::serverUUID=00a9bd14-7a7d-11e1-bdfe-bc305ba28b2b-403501971)) BridgeClusterConnectionBridge@79815969 [name=sf.my-cluster.df163c73-992d-11e1-8551-3c075467076e, queue=QueueImpl[name=sf.my-cluster.df163c73-992d-11e1-8551-3c075467076e, postOffice=PostOfficeImpl [server=HornetQServerImpl::serverUUID=00a9bd14-7a7d-11e1-bdfe-bc305ba28b2b]]@1b153ad1 targetConnector=ServerLocatorImpl (identity=(Cluster-connection-bridge::ClusterConnectionBridge@79815969 [name=sf.my-cluster.df163c73-992d-11e1-8551-3c075467076e, queue=QueueImpl[name=sf.my-cluster.df163c73-992d-11e1-8551-3c075467076e, postOffice=PostOfficeImpl [server=HornetQServerImpl::serverUUID=00a9bd14-7a7d-11e1-bdfe-bc305ba28b2b]]@1b153ad1 targetConnector=ServerLocatorImpl [initialConnectors=[org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=0-0-0-0], discoveryGroupConfiguration=null]]::ClusterConnectionImpl@1462857349[nodeUUID=00a9bd14-7a7d-11e1-bdfe-bc305ba28b2b, connector=org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=0-0-0-0, address=jms, server=HornetQServerImpl::serverUUID=00a9bd14-7a7d-11e1-bdfe-bc305ba28b2b])) [initialConnectors=[org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=0-0-0-0], discoveryGroupConfiguration=null]] is connected
Some questions:
1 - Is this even possible? Is it the correct way to use JMS clustering? If not, what is a better solution? Note that app A and B are pretty heavy-weight apps and we'd prefer to not have to deploy app B to both servers. Also, there would be a considerable re-write involved with putting the consumer in app B in app A as well.
2 - Based on my reading of how HornetQ's round robin algorithm works, queue writes on app A should go to the queue on app B since there is no consumer in app A for that queue. We're not seeing this behavior. (forward-when-no-consumers - default value is false) What we do see is the JMS message sits in the queue on app A indefinitely. Any queue writes from app B are immidiately picked up by the consumer in app B.
3 - If we're missing something and our assumption from #2, above, is correct but configured incorrectly, what happens if the server hosting app B crashes, messages are created by app A (I assume these would be sent to the queue on app A since app B is down), and then the server hosting app B is brought back up? Would the messages be forwarded in that case?