1 25 package org.objectweb.easybeans.tests.common.ejbs.mdb.containermanaged.transaction; 26 27 import javax.ejb.ActivationConfigProperty ; 28 import javax.ejb.EJB ; 29 import javax.ejb.EJBException ; 30 import javax.ejb.MessageDriven ; 31 import javax.ejb.TransactionAttribute ; 32 import javax.ejb.TransactionAttributeType ; 33 import javax.jms.Message ; 34 import javax.jms.MessageListener ; 35 36 import org.objectweb.easybeans.log.JLog; 37 import org.objectweb.easybeans.log.JLogFactory; 38 import org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType; 39 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.BaseInsertCallbackEvent; 40 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.inheritance.ItfCMTInheritance; 41 import org.objectweb.easybeans.tests.common.jms.JMSManager; 42 43 49 @MessageDriven (activationConfig = { 50 @ActivationConfigProperty (propertyName = "destination", propertyValue = JMSManager.DEFAULT_QUEUE), 51 @ActivationConfigProperty (propertyName = "destinationType", propertyValue = "javax.jms.Queue"), 52 @ActivationConfigProperty (propertyName = "messageSelector", propertyValue = 53 "TYPE = 'org.objectweb.easybeans.tests.common.ejbs.mdb.containermanaged.transaction.MDBCMTRequired'")}) 54 @TransactionAttribute (TransactionAttributeType.REQUIRED) 55 public class MDBCMTRequired extends BaseInsertCallbackEvent implements MessageListener { 56 57 60 public static final String MESSAGE_TYPE = "org.objectweb.easybeans.tests.common.ejbs." 61 + "mdb.containermanaged.transaction.MDBCMTRequired"; 62 63 66 @EJB (beanName = "SLSBCMTInheritance") 67 private ItfCMTInheritance bean; 68 69 72 private static JLog logger = JLogFactory.getLog(MDBCMTNotSupported.class); 73 74 78 public void onMessage(final Message message) { 79 try { 80 logger.debug("Invoking dummyMethod1."); 83 bean.dummyMethod1(); 84 logger.debug("Invoking dummyMethod1 should throw an EJBException."); 85 } catch (EJBException e) { 86 logger.debug("MDB is OK."); 87 super.log(MDBCMTRequired.class, CallbackType.ON_MESSAGE, MDBCMTRequired.class); 88 } catch (Exception e) { 89 logger.error("Error. Exception = {0}", e.getCause()); 90 } 91 } 92 93 } 94 | Popular Tags |