1 22 package org.jboss.ejb3.test.mdb; 23 24 import javax.annotation.Resource; 25 import javax.annotation.security.RunAs; 26 import javax.ejb.ActivationConfigProperty ; 27 import javax.ejb.MessageDriven ; 28 import javax.ejb.MessageDrivenContext ; 29 import javax.jms.Message ; 30 import javax.jms.MessageListener ; 31 32 import org.jboss.annotation.security.SecurityDomain; 33 import org.jboss.logging.Logger; 34 35 41 @MessageDriven (activationConfig = 42 { 43 @ActivationConfigProperty (propertyName="destinationType", propertyValue="javax.jms.Queue"), 44 @ActivationConfigProperty (propertyName="destination", propertyValue="queue/cmtmdbtest"), 45 @ActivationConfigProperty (propertyName="DLQMaxResent", propertyValue="1") 46 }) 47 @RunAs("TestRole") 48 @SecurityDomain("other") 49 public class CMTQueueTestMDB implements MessageListener 50 { 51 @SuppressWarnings ("unused") 52 private static final Logger log = Logger.getLogger(CMTQueueTestMDB.class); 53 54 private static boolean thrownException = false; 55 @Resource MessageDrivenContext ctx; 56 57 public void onMessage(Message recvMsg) 58 { 59 System.out.println("*** CMTQueueTestMDB onMessage " + thrownException); 60 if (ctx == null) throw new RuntimeException ("FAILED ON CTX LOOKUP"); 61 62 if (!thrownException) 63 { 64 thrownException = true; 65 throw new RuntimeException (); 66 } 67 68 TestStatusBean.cmtQueueRan++; 69 } 70 } 71 | Popular Tags |