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