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/rollbackcmtmdbtest"), 45 @ActivationConfigProperty (propertyName="DLQMaxResent", propertyValue="1") 46 }) 47 @RunAs("TestRole") 48 @SecurityDomain("other") 49 public class RollbackCMTQueueTestMDB implements MessageListener 50 { 51 @SuppressWarnings ("unused") 52 private static final Logger log = Logger.getLogger(RollbackCMTQueueTestMDB.class); 53 54 private static boolean rolledback = false; 55 @Resource MessageDrivenContext ctx; 56 57 public void onMessage(Message recvMsg) 58 { 59 System.out.println("*** RollbackCMTQueueTestMDB onMessage " + rolledback); 60 if (ctx == null) throw new RuntimeException ("FAILED ON CTX LOOKUP"); 61 62 if (!rolledback) 63 { 64 rolledback = true; 65 ctx.setRollbackOnly(); 66 return; 67 } 68 69 TestStatusBean.rollbackCmtQueueRan++; 70 } 71 } 72 | Popular Tags |