1 22 package org.jboss.ejb3.test.mdb; 23 24 import javax.ejb.ActivationConfigProperty ; 25 import javax.interceptor.AroundInvoke; 26 import javax.interceptor.InvocationContext; 27 import javax.ejb.MessageDriven ; 28 import javax.ejb.MessageDrivenContext ; 29 import javax.jms.Message ; 30 import javax.jms.MessageListener ; 31 import javax.annotation.PostConstruct; 32 import javax.annotation.PreDestroy; 33 import javax.annotation.Resource; 34 35 41 @MessageDriven (activationConfig = 42 { 43 @ActivationConfigProperty (propertyName="destinationType", propertyValue="javax.jms.Topic"), 44 @ActivationConfigProperty (propertyName="destination", propertyValue="topic/mdbtest"), 45 @ActivationConfigProperty (propertyName="subscriptionDurability", propertyValue="Durable"), 46 @ActivationConfigProperty (propertyName="subscriptionName", propertyValue="topicmdb"), 47 @ActivationConfigProperty (propertyName="clientId", propertyValue="mdb-test") 48 }) 49 public class TopicTestMDB implements MessageListener 50 { 51 @Resource MessageDrivenContext ctx; 52 public void onMessage(Message recvMsg) 53 { 54 if (ctx == null) throw new RuntimeException ("FAILED ON CTX LOOKUP"); 55 TestStatusBean.topicRan++; 56 System.out.println("*** TopicTestMDB onMessage " + TestStatusBean.topicRan + " " + recvMsg); 57 } 58 59 @AroundInvoke 60 public Object intercept(InvocationContext ctx) throws Exception 61 { 62 TestStatusBean.interceptedTopic = true; 63 return ctx.proceed(); 64 } 65 } 66 | Popular Tags |