Skip to content

Instantly share code, notes, and snippets.

@milenkovicm
Created February 4, 2012 22:37
Show Gist options
  • Save milenkovicm/1740772 to your computer and use it in GitHub Desktop.
Save milenkovicm/1740772 to your computer and use it in GitHub Desktop.
MDB bean
package com.e.test.service.first.controller;
import javax.ejb.MessageDriven;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
import javax.ejb.ActivationConfigProperty;
@MessageDriven(name = "MDBService", activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/test"),
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge") })
public class MDBService implements MessageListener {
@Override
public void onMessage(Message message) {
try {
System.out.println("------> R: "+((TextMessage) message).getText());
} catch (JMSException e) {
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment