aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes MDB listening to external MQ in Glassfish Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "MDB listening to external MQ in Glassfish" Watch "MDB listening to external MQ in Glassfish" New topic
Author

MDB listening to external MQ in Glassfish

Mikael Thorman
Greenhorn

Joined: Dec 31, 2008
Posts: 1
Hello,

I am trying to setup a configuration where I have an application server (Glassfish) with its own OpenMQ (Local) but where I want one specific bean to post to a queue on another MQ and also to have an MDB which listens to a queue on this other MQ.
All other traffic is done on the local MQ.

Posting a msg on the external queue works fine after I added an AddressList entry to the connection factory for this queue.

The problem is to get the MDB to listen to a queue on the external OpenMQ. I tried to add an equal AddressList entry to the connection factory for this queue on the local glassfish, but it only listens to the queue on this machine not the external one.

As I have understood it you have to add a connection factory and a destination on both app servers, even though I actually only want to communicate on the queue on machine A.

Example.
I have 2 machines A & B, each with its own OpenMQ instance.
A has IP address 192.168.0.1 & B has IP address 192.168.0.2.
On machine A I deploy a communication server which can send & receive messages to/from a phone.
On machine B I deploy an application that wants to be able to send messages to a phone & receive send statuses for this transmission.

I want 1 queue: sendMsg
and 1 topic: sendStatus

I then create the following:
On machine A:
2 connection factories: jms/sendMsgFactory & jms/sendStatusFactory
2 destinations: jms/sendMsg (with property Name = SEND_MSG) & jms/sendStatus (with property Name = SEND_STATUS)

On machine B:
2 connection factories: jms/sendMsgFactory & jms/sendStatusFactory
2 destinations: jms/sendMsg & jms/sendStatus
Both connection factories has an AddressList property with value 192.168.0.1:7676

I then create an MDB which listens to the send status queue:
@MessageDriven(mappedName = "jms/sendStatus", activationConfig = {
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic")
})
public class TestQueueMdbBean implements MessageListener {

public TestQueueMdbBean() {
}

public void onMessage(Message message) {

System.out.println("A message was received !");

System.out.println("message: " + message.toString());
}
}

My guess is that the jms/sendStatusFactory isn't used while we set mappedName = "jms/sendStatus" & it then uses the local topicinstead of using the external which is defined in the factory.

Could this be correct & in this case how do I configure the MDB to use the factory instead ?

If I post a msg on the destination jms/sendStatus from an app on machine A or B this is received by an MDB on machine A (and an Hermes client running on machine A).

If I post a msg on the topic SEND_STATUS from a Hermes JMS app on machine A this is received by an MDB on machine A.

If I post a msg on the topic SEND_STATUS from a Hermes JMS app on machine B this is received by an MDB on machine B.

These tests make me believe that sending a msg to the destination uses the factory which is connected correctly (using the AddressList), but when the MDB listens on machine B it listens to its own topic (ignoring the factory).

Thanks for any help.

// thorman
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MDB listening to external MQ in Glassfish