1 22 package org.jboss.test.mdb.bean; 23 24 import javax.ejb.MessageDrivenBean ; 25 import javax.ejb.MessageDrivenContext ; 26 import javax.ejb.EJBException ; 27 28 import javax.jms.MessageListener ; 29 import javax.jms.Message ; 30 39 40 public class ExQueueBean implements MessageDrivenBean , MessageListener { 41 42 org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(getClass()); 43 44 private MessageDrivenContext ctx = null; 45 public ExQueueBean() { 46 47 } 48 public void setMessageDrivenContext(MessageDrivenContext ctx) 49 throws EJBException { 50 this.ctx = ctx; 51 } 52 53 public void ejbCreate() {} 54 55 public void ejbRemove() {ctx=null;} 56 57 public void onMessage(Message message) { 58 log.debug("ExQueueBean rolling back transaction" + message.toString()); 59 ctx.setRollbackOnly(); 60 } 61 } 63 64 65 | Popular Tags |