1 22 package org.jboss.ejb3.test.dd.mdb; 23 24 import javax.annotation.Resource; 25 import javax.ejb.MessageDrivenBean ; 26 import javax.ejb.MessageDrivenContext ; 27 import javax.ejb.EJBException ; 28 29 import javax.jms.MessageListener ; 30 import javax.jms.Message ; 31 import javax.jms.ObjectMessage ; 32 33 40 41 public class ObjectMessageBean implements MessageDrivenBean , MessageListener 42 { 43 org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(getClass()); 44 45 private MessageDrivenContext ctx = null; 46 47 public ObjectMessageBean() 48 { 49 50 } 51 52 @Resource 53 public void setMessageDrivenContext(MessageDrivenContext ctx) throws EJBException 54 { 55 this.ctx = ctx; 56 } 57 58 public void ejbCreate() 59 { 60 } 61 62 public void ejbRemove() 63 { 64 ctx = null; 65 } 66 67 public void onMessage(Message message) 68 { 69 try 70 { 71 TestStatusBean.addDestination(message.getJMSDestination()); 72 ObjectMessage om = (ObjectMessage ) message; 73 log.debug("DEBUG: ObjectMessageBean got object: " + om.getObject().toString()); 74 } 75 catch (Throwable e) 76 { 77 log.error("failed", e); 78 } 79 } 80 } 81 | Popular Tags |