1 22 package org.jboss.ejb3.test.mdbtransactions; 23 24 import javax.ejb.ActivationConfigProperty ; 25 import javax.ejb.EJB ; 26 import javax.ejb.MessageDriven ; 27 import javax.jms.Message ; 28 import javax.jms.MessageListener ; 29 import javax.jms.ObjectMessage ; 30 import javax.persistence.EntityManager; 31 import javax.persistence.PersistenceContext; 32 33 import org.jboss.logging.Logger; 34 35 38 @MessageDriven (activationConfig = 39 { 40 @ActivationConfigProperty (propertyName="destinationType", propertyValue="javax.jms.Queue"), 41 @ActivationConfigProperty (propertyName="destination", propertyValue="queue/rollbackmdbtest") 42 }) 43 public class RollbackQueueTestMDB implements MessageListener 44 { 45 private static final Logger log = Logger.getLogger(QueueTestMDB.class); 46 47 private @PersistenceContext EntityManager manager; 48 @EJB StatelessFacade stateless; 49 50 public void onMessage(Message recvMsg) 51 { 52 try 53 { 54 ObjectMessage message = (ObjectMessage )recvMsg; 55 Entity entity = (Entity)message.getObject(); 56 manager.remove(entity); 57 } 58 catch (Throwable t) 59 { 60 t.printStackTrace(); 61 } 62 } 63 } 64 | Popular Tags |