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 import javax.jms.ObjectMessage ; 31 38 39 public class ObjectMessageBean implements MessageDrivenBean , MessageListener { 40 org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(getClass()); 41 42 private MessageDrivenContext ctx = null; 43 public ObjectMessageBean() { 44 45 } 46 public void setMessageDrivenContext(MessageDrivenContext ctx) 47 throws EJBException { 48 this.ctx = ctx; 49 } 50 51 public void ejbCreate() {} 52 53 public void ejbRemove() {ctx=null;} 54 55 public void onMessage(Message message) { 56 try { 57 ObjectMessage om = (ObjectMessage )message; 58 log.debug("DEBUG: ObjectMessageBean got object: " + 59 om.getObject().toString() ); 60 } catch ( Throwable e ) { 61 log.error("failed", e); 62 } 63 } 64 } 65 66 67 | Popular Tags |