I have a clustered environment with 2 nodes(node1 and node2), and both node1 and node2 have a queue named "exampleQueue". And i want to use the UDP connection to access this group.
DiscoveryGroupConfiguration groupConfiguration = new DiscoveryGroupConfiguration("126.96.36.199", 9876);
ConnectionFactory cf = (ConnectionFactory)HornetQJMSClient.createConnectionFactoryWithoutHA(groupConfiguration, JMSFactoryType.CF);
Queue queue = HornetQJMSClient.createQueue("exampleQueue");
The sending message part is working perfectly. If i send 10 message to the queue by using the UDP connection, 5 of them will go to the node1 and the other 5 will go to node2 according to the round robin fashion.
The problem is the consumer: if i create one consumer based on this UDP connection, it will be created on either node1 or node2(i can observe from jconsole). Suppose the consumer is on the node1, it can consume all these messages from node2, but it can't consumer message form node2. This is not i want, what i want is this cluster of hornetq servers is totally transparent to clients(my client is PHP and listener is JAVA). It should be like clients send request messages to queue1 and get response messages from queue2, and it does not need to care which node should be going to, just use the common cluster connection.
My real scenario is like this:
1>. PHP(STOMP) sends a request message to request queue, and waits for the response from the response queue;
2>. JAVA has listeners to listen this request queue (based on spring listener container).
3>. After gets this message, JAVA will process this message(bussiness logic, database operations...);
4>. Then JAVA will send the response message to the response queue;
5>. And the PHP will get the response message from the response queue(using selector).
So my question is: is that possible for a consumer to consume(select) messages based on cluster level not node level? I should just care about the clusted connection(Like UDP).
One more question: Can PHP(STOMP) use UDP connection(188.8.131.52) to access to clusted hornetq sever? I never try this, i wanna confirm.
Thanks in advance!