org.mule.processor
Class SedaStageInterceptingMessageProcessor

java.lang.Object
  extended by org.mule.processor.AbstractInterceptingMessageProcessorBase
      extended by org.mule.processor.AbstractInterceptingMessageProcessor
          extended by org.mule.processor.AsyncInterceptingMessageProcessor
              extended by org.mule.processor.SedaStageInterceptingMessageProcessor
All Implemented Interfaces:
Runnable, javax.resource.spi.work.Work, AnnotatedObject, MuleContextAware, Disposable, Initialisable, Lifecycle, Startable, Stoppable, InterceptingMessageProcessor, MessageProcessor, MessageProcessorContainer, MessageSource, Pausable, Resumable
Direct Known Subclasses:
LaxSedaStageInterceptingMessageProcessor

public class SedaStageInterceptingMessageProcessor
extends AsyncInterceptingMessageProcessor
implements javax.resource.spi.work.Work, Lifecycle, Pausable, Resumable

Processes MuleEvent's asynchronously using a MuleWorkManager to schedule asynchronous processing of the next MessageProcessor.


Field Summary
protected  SedaStageLifecycleManager lifecycleManager
           
protected  Queue queue
           
protected static String QUEUE_NAME_PREFIX
           
protected  QueueConfiguration queueConfiguration
           
protected  String queueName
           
protected  QueueProfile queueProfile
           
protected  QueueStatistics queueStatistics
           
protected  int queueTimeout
           
 
Fields inherited from class org.mule.processor.AsyncInterceptingMessageProcessor
doThreading, SYNCHRONOUS_EVENT_ERROR_MESSAGE, workManager, workManagerSource
 
Fields inherited from class org.mule.processor.AbstractInterceptingMessageProcessorBase
logger, muleContext, next, notificationHandler
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Startable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Stoppable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Fields inherited from interface org.mule.service.Pausable
PHASE_NAME
 
Fields inherited from interface org.mule.service.Resumable
PHASE_NAME
 
Fields inherited from interface org.mule.api.AnnotatedObject
PROPERTY_NAME
 
Constructor Summary
SedaStageInterceptingMessageProcessor(String threadName, String queueName, QueueProfile queueProfile, int queueTimeout, ThreadingProfile threadingProfile, QueueStatistics queueStatistics, MuleContext muleContext)
           
 
Method Summary
protected  MuleEvent dequeue()
           
 void dispose()
          A lifecycle method where implementor should free up any resources.
protected  void enqueue(MuleEvent event)
           
protected  String getQueueName()
           
 int getQueueSize()
           
protected  String getStageDescription()
           
protected  String getStageName()
           
 void initialise()
          Method used to perform any initialisation work.
protected  boolean isQueuePersistent()
          Are the events in the SEDA queue persistent?
protected  boolean isStatsEnabled()
           
 void pause()
           
protected  void processNextAsync(MuleEvent event)
           
 void release()
           
 void resume()
           
protected  void rollbackDequeue(MuleEvent event)
          Roll back the previous dequeue(), i.e., put the event at the front of the queue, not at the back which is what enqueue() does.
 void run()
          While the service isn't stopped this runs a continuous loop checking for new events in the queue.
 void start()
           
 void stop()
           
protected  void waitIfPaused()
           
 
Methods inherited from class org.mule.processor.AsyncInterceptingMessageProcessor
fireAsyncScheduledNotification, firePipelineNotification, isProcessAsync, process, processNextTimed
 
Methods inherited from class org.mule.processor.AbstractInterceptingMessageProcessorBase
addMessageProcessorPathElements, getAnnotation, getAnnotations, getListener, getMuleContext, isEventValid, processNext, setAnnotations, setListener, setMuleContext, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mule.api.source.MessageSource
setListener
 

Field Detail

QUEUE_NAME_PREFIX

protected static final String QUEUE_NAME_PREFIX
See Also:
Constant Field Values

queueProfile

protected QueueProfile queueProfile

queueTimeout

protected int queueTimeout

queueStatistics

protected QueueStatistics queueStatistics

queueName

protected String queueName

queue

protected Queue queue

queueConfiguration

protected QueueConfiguration queueConfiguration

lifecycleManager

protected SedaStageLifecycleManager lifecycleManager
Constructor Detail

SedaStageInterceptingMessageProcessor

public SedaStageInterceptingMessageProcessor(String threadName,
                                             String queueName,
                                             QueueProfile queueProfile,
                                             int queueTimeout,
                                             ThreadingProfile threadingProfile,
                                             QueueStatistics queueStatistics,
                                             MuleContext muleContext)
Method Detail

processNextAsync

protected void processNextAsync(MuleEvent event)
                         throws MuleException
Overrides:
processNextAsync in class AsyncInterceptingMessageProcessor
Throws:
MuleException

isStatsEnabled

protected boolean isStatsEnabled()

enqueue

protected void enqueue(MuleEvent event)
                throws Exception
Throws:
Exception

dequeue

protected MuleEvent dequeue()
                     throws Exception
Throws:
Exception

rollbackDequeue

protected void rollbackDequeue(MuleEvent event)
Roll back the previous dequeue(), i.e., put the event at the front of the queue, not at the back which is what enqueue() does.


run

public void run()
While the service isn't stopped this runs a continuous loop checking for new events in the queue.

Specified by:
run in interface Runnable

isQueuePersistent

protected boolean isQueuePersistent()
Are the events in the SEDA queue persistent?


getQueueSize

public int getQueueSize()

getQueueName

protected String getQueueName()

getStageName

protected String getStageName()

getStageDescription

protected String getStageDescription()

waitIfPaused

protected void waitIfPaused()
                     throws InterruptedException
Throws:
InterruptedException

release

public void release()
Specified by:
release in interface javax.resource.spi.work.Work

initialise

public void initialise()
                throws InitialisationException
Description copied from interface: Initialisable
Method used to perform any initialisation work. If a fatal error occurs during initialisation an InitialisationException should be thrown, causing the Mule instance to shutdown. If the error is recoverable, say by retrying to connect, a RecoverableException should be thrown. There is no guarantee that by throwing a Recoverable exception that the Mule instance will not shut down.

Specified by:
initialise in interface Initialisable
Throws:
InitialisationException - if a fatal error occurs causing the Mule instance to shutdown
RecoverableException - if an error occurs that can be recovered from

start

public void start()
           throws MuleException
Specified by:
start in interface Startable
Overrides:
start in class AsyncInterceptingMessageProcessor
Throws:
MuleException

stop

public void stop()
          throws MuleException
Specified by:
stop in interface Stoppable
Overrides:
stop in class AsyncInterceptingMessageProcessor
Throws:
MuleException

dispose

public void dispose()
Description copied from interface: Disposable
A lifecycle method where implementor should free up any resources. If an exception is thrown it should just be logged and processing should continue. This method should not throw Runtime exceptions.

Specified by:
dispose in interface Disposable

pause

public void pause()
           throws MuleException
Specified by:
pause in interface Pausable
Throws:
MuleException

resume

public void resume()
            throws MuleException
Specified by:
resume in interface Resumable
Throws:
MuleException


Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.