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 31 import org.jboss.logging.Logger; 32 33 42 43 public class TopicBean implements MessageDrivenBean , MessageListener { 44 private static final Logger log = Logger.getLogger(TopicBean.class); 45 private MessageDrivenContext ctx = null; 46 public TopicBean() { 47 48 } 49 public void setMessageDrivenContext(MessageDrivenContext ctx) 50 throws EJBException { 51 this.ctx = ctx; 52 } 53 54 public void ejbCreate() {} 55 56 public void ejbRemove() {ctx=null;} 57 58 public void onMessage(Message message) { 59 if (ctx.getRollbackOnly()) 60 throw new IllegalStateException ("Error in transaction"); 61 log.debug("DEBUG: TopicBean got message" + message.toString() ); 62 } 63 } 65 66 | Popular Tags |