Technologies used.
- ActiveMQ 5.5.1
- Glassfish 3.1
- genericra 2.1
Where I am at;
- I have ActiveMQ installed and running
- genericra is configured and working in Glassfish. I have configured a connector resource (amqRes), Connector connection pool (amqPool) and admin object resource (amqQueue). Deployed genericra and configured the resource adapter configs.
- I am able to post a message onto the activeMQ queue from an app running in Glassfish. When I post I can see a new entry on the queue in activeMQ admin console.
We are using other JMS queues (within glassfish) and they work well.
The trouble I'm having is getting a message off the queue from activeMQ. I have written a test @MessageDriven bean that implements javax.jms.MessageListener. It has one simple method (onMessage) that just outputs the message. I'm not sure how to register the MDB so that it picks up messages from the activeMQ queue. I have seen quite a few examples of putting entries in ejb-jar.xml, glassfish-ejb-jar.xml or sun-ejb-jar.xml - none of which have worked for me. When I look in the activeMQ console I can't see any consumers for the queue I've created.
I have read a number of blogs but seem to be missing this last piece of the jigsaw.
import javax.ejb.MessageDriven;
import javax.jms.Message;
@MessageDriven(mappedName = "amqQueue")
public class ActiveMQTestListener implements javax.jms.MessageListener {
public void onMessage(Message message) {
System.out.println(message.toString());
}
}