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
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4244875#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...