[jboss-user] [JBoss AOP Users] - Re: Deploy AOP to jboss 5.1

kgreenejpmc do-not-reply at jboss.com
Tue Aug 25 15:36:32 EDT 2009


Ok, after quite a bit of trial and error I finally got the aop to work.  However, I have a question.  

If I put my @JobFlow annotation on the onMessage method, the aop does not work.  However, If I put the @JobFlow annotation on the processMessage method (which onMessage calls), the aop works.  Does jboss suppress or ignore custom annotations on onMessage?  If so, is there a way to enable them to work on onMessage?


  | @MessageDriven(activationConfig = {
  | 		@ActivationConfigProperty(propertyName="maxMessages", propertyValue="1"),
  | 		@ActivationConfigProperty(propertyName="maxSession", propertyValue="3"),
  | 		@ActivationConfigProperty(propertyName="dLQMaxResent", propertyValue="1"),
  | 		@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
  | 		@ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/TestConsumer1")
  | })
  | @Clustered
  | public class TestConsumer1 implements MessageListener {
  | 
  | 
  | 	
  | 
  | 	private static Logger log = Logger.getLogger(TestConsumer1.class);
  | 
  | 	@Resource
  | 	private MessageDrivenContext context;
  | 
  | 	
  | 
  | 	//put @JobFlow here does not work. The aop does not get called
  | 	public void onMessage(Message msg) {
  | 		log.info("Got message.");
  | 		
  | 		
  | 		try 
  | 		{
  | 			processMessage(msg);
  | 			TextMessage txtMsg = (TextMessage)msg;
  | 			String stagingPath = txtMsg.getText();
  | 			
  | 			log.info("FlowId: " + MessageProperties.getFlowId(msg));
  | 			log.info("JobId: " + MessageProperties.getJobId(msg));
  | 			log.info("PrevStageId: " + MessageProperties.getPrevStageId(msg));
  | 			
  | 		} 
  | 		catch (Exception e) 
  | 		{
  | 			context.setRollbackOnly();
  | 			
  | 		}
  | 
  | 		
  | 		log.info("DONE!");
  | 	}
  | 	
  | 
  |        //putting @JobFlow here works and the aop is called
  | 	@JobFlow
  | 	public void processMessage(Message msg)
  | 	{
  | 		log.info("Running processMessage");
  | 	}
  | 
  | }
  | 

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4251632#4251632

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4251632



More information about the jboss-user mailing list