We have a GlassFish cluster with two instances, hosted on Jelastic.com. The application produces messages on a queue "the_output_queue".
We want to consume the output messages with a simple and light-weight JMS client running somewhere else (this could maybe even be an Android app).
GlassFish sets up Message Queue as an embedded broker cluster, which in turn has also two broker instances corresponding directly to the two GlassFish instances.
If I understand this description of "Cluster Message Delivery" correctly, a JMS client should be able to connect to ANY of the two broker instances and be able to receive ALL messages written to the_output_queue:
The home broker is responsible for routing and delivering the messages to all consumers of the destination, whether these consumers are local (connected to the home broker) or remote (connected to other brokers in the cluster).
But this is not working as I hoped. Messages for the_output_queue are distributed in a round-robin manner to both brokers. With only one JMS client, connected to the first broker, I see only every other message. (With a second JMS client connected to the second broker I get the other half of the messages).
The JMS clients connect to the physical queue directly, not with JNDI. Basically:
ConnectionFactory myFctry = new com.sun.messaging.ConnectionFactory();
myFctry.setProperty(ConnectionConfiguration.imqAddressList, "thathost:27676");
Connection myConnection = myFctry.createConnection();
Session mySession = myConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Destination myDest = new com.sun.messaging.Queue("the_output_queue");
MessageConsumer messageConsumer = mySession.createConsumer(myDest);
myConnection.start();
Message incomingMsg = messageConsumer.receive();
Did I misunderstand how a broker cluster works?
How should a stand-alone JMS consumer connect to a broker cluster?
Or if it should be working the way I thought: What should I check in the GlassFish and Message Queue configurations? (Note: I am in Jelastic and have no command line utilities available, only the GlassFish Administration Console.).
[We never asked for a Message Queue broker cluster, but that is what you get with a GlassFish cluster. And a remote broker is currently not possible with Jelastic.]