View Javadoc

1   /*
2    * $Id: LaxSedaStageInterceptingMessageProcessor.java 22864 2011-09-05 17:18:46Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.processor;
12  
13  import org.mule.api.MessagingException;
14  import org.mule.api.MuleContext;
15  import org.mule.api.MuleEvent;
16  import org.mule.api.config.ThreadingProfile;
17  import org.mule.api.lifecycle.Lifecycle;
18  import org.mule.api.processor.MessageProcessor;
19  import org.mule.config.QueueProfile;
20  import org.mule.management.stats.QueueStatistics;
21  import org.mule.service.Pausable;
22  import org.mule.service.Resumable;
23  import org.mule.work.MuleWorkManager;
24  
25  import javax.resource.spi.work.Work;
26  
27  /**
28   * Processes {@link MuleEvent}'s asynchronously using a {@link MuleWorkManager} to schedule asynchronous
29   * processing of the next {@link MessageProcessor}.
30   */
31  public class LaxSedaStageInterceptingMessageProcessor extends SedaStageInterceptingMessageProcessor
32      implements Work, Lifecycle, Pausable, Resumable
33  {
34  
35      public LaxSedaStageInterceptingMessageProcessor(String name,
36                                                      String queueName,
37                                                      QueueProfile queueProfile,
38                                                      int queueTimeout,
39                                                      ThreadingProfile threadingProfile,
40                                                      QueueStatistics queueStatistics,
41                                                      MuleContext muleContext)
42      {
43          super(name, queueName, queueProfile, queueTimeout, threadingProfile, queueStatistics, muleContext);
44      }
45  
46      @Override
47      protected boolean isProcessAsync(MuleEvent event) throws MessagingException
48      {
49          return doThreading && !event.isSynchronous();
50      }
51  }