Reputation: 19
My project publishes RESTful/SOAP services. One of these sends messages to a JMS queue on a Websphere application server. The application runs on the same application server. What I need is to define a listener to this queue. How can I activate this listener without a direct call from the service?
The project structure looks like this:
Project:
-ejb
-rest
-soap
The user calls methods on the service, which calls the EJB component, so I dont have any main method where I can init the listener.
I need a solution which activates a permanent listener to the queue.
I already have the source code I just don't know how to initialize the listener.
Upvotes: 0
Views: 1114
Reputation: 19
WebSphere MDB with a lot of configuration it works!!!! But look at this:
@MessageDriven(activationConfig={
@ActivationConfigProperty(propertyName="destination", propertyValue="myDestination"),
@ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue")
})
public class MsgBean implements javax.jms.MessageListener {
public void onMessage(javax.jms.Message msg) {
String receivedMsg = ((TextMessage) msg).getText();
System.out.println("Received message: " + receivedMsg);
}
}
Upvotes: 0
Reputation: 38142
Not sure where you have the issues:
Do something like:
Upvotes: 1