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