-
1. Re: Clustered messages not being received by external client
clebert.suconic Jul 20, 2009 7:38 PM (in response to ejb3workshop)This is probably due to the way JBoss Messaging works regarding the local queues.
Message are aways sent to the local server, until you need move messages.
Take a look on the manual and WIKIs about how clustering works on JBoss messaging 1.4. -
2. Re: Clustered messages not being received by external client
ejb3workshop Jul 20, 2009 9:25 PM (in response to ejb3workshop)Surely this can't be the case. It would be a big problem for me if I were not able to deliver outbound messages to external clients. It is not viable for the client to know which cluster node will respond. Not even sure if this is possible since the messages are distributed at random / round robin.
Has this been resolved in release 2.x of JBoss Messaging and can I integrate that release into JBoss 4.2.3 / JBoss EAP ?
Thanks in advance. -
3. Re: Clustered messages not being received by external client
gaohoward Jul 20, 2009 10:53 PM (in response to ejb3workshop)Did you deploy the 'response queue' as distributed queue?
Can you put it's configuration here? thanks. -
4. Re: Clustered messages not being received by external client
timfox Jul 21, 2009 4:22 AM (in response to ejb3workshop)If you have a queue called "responseQueue" deployed on each of your nodes, how can JBoss Messaging possibly know which actual version of responseQueue on what node to send the response to? JBM is not psychic ;)
It can't, you simply haven't given it enough information.
The proper way of implementing this pattern is to implement a temporary response queue which will have a unique name across the cluster, then when you send a response to it from any other node, JBM will unambiguously know where to route it, otherwise it has no idea which node to route it to.
Alternatively you can create a response topic and consume responses with a selector (response_id=X). Either way will work.
BTW There are tests in the test suite for this. -
5. Re: Clustered messages not being received by external client
ejb3workshop Jul 21, 2009 5:02 AM (in response to ejb3workshop)I am defining the destinations in abc-services.xml which is referenced in the jboss-app.xml file. Both these are included in the EAR file containing the MDBs. This application is deployed into the farm folder of the JBoss nodes in the cluster. My assumption is that since the destinations are set to be clustered and the application is deployed into the cluster wide farm folder JBoss would be able to figure it out. Any messages sent to JBoss are distributed across the clustered nodes, so it seems to work for receiving messaged inside JBoss. The JMX console also only shows a single destination, which is what I would have expected.
<?xml version="1.0" encoding="UTF-8"?> <server> ... <mbean code="org.jboss.jms.server.destination.QueueService" name="jboss.messaging.destination:service=Queue,name=Responses" xmbean-dd="xmdesc/Queue-xmbean.xml"> <attribute name="JNDIName">queue/abc/Responses</attribute> <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends> <depends>jboss.messaging:service=PostOffice</depends> <attribute name="Clustered">true</attribute> </mbean> </server>
The problem is only apparent when the receiving client is a stand-alone application running outside the application server.
This is the code I use to receive the messages.InitialContext jndiContext = new InitialContext(props); // connect to JNDI to get JMS Queue Factory QueueConnectionFactory qFactory = (QueueConnectionFactory) jndiContext.lookup("ClusteredConnectionFactory"); // e.g. javax.jms.QueueConnectionFactory // look up and connect to Response Queue System.out.println("Connecting to JMS Response Queue: " + props.getProperty("jmsResponseQueue")); Queue responseQ = (Queue) jndiContext.lookup("queue/abc/Responses"); QueueConnection responseQconn = qFactory.createQueueConnection(); QueueSession responseQSession = responseQconn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); QueueReceiver responseQrecv = responseQSession.createReceiver(responseQ); System.out.println("Ready to receive messages"); responseQconn.start(); Message msg = responseQrecv.receive(60000); ...
Thanks in advance.
Alex