org.mule.routing
Class UntilSuccessful

java.lang.Object
  extended by org.mule.processor.AbstractMuleObjectOwner<MessageProcessor>
      extended by org.mule.processor.AbstractMessageProcessorOwner
          extended by org.mule.routing.outbound.AbstractOutboundRouter
              extended by org.mule.routing.UntilSuccessful
All Implemented Interfaces:
AnnotatedObject, FlowConstructAware, MuleContextAware, Disposable, Initialisable, Lifecycle, Startable, Stoppable, MessageProcessor, MessageProcessorContainer, MessageRouter, Matchable, MatchableMessageProcessor, MatchableMessageRouter, OutboundRouter, RouterStatisticsRecorder, UntilSuccessfulConfiguration

public class UntilSuccessful
extends AbstractOutboundRouter
implements UntilSuccessfulConfiguration

UntilSuccessful attempts to route a message to the message processor it contains. Routing is considered successful if no exception has been raised and, optionally, if the response matches an expression. UntilSuccessful internal route can be executed synchronously or asynchronously depending on the threading profile defined on it. By default, if no threading profile is defined, then it will use the default threading profile configuration for the application. This means that the default behavior is to process asynchronously. UntilSuccessful can optionally be configured to synchronously return an acknowledgment message when it has scheduled the event for processing. UntilSuccessful is backed by a ListableObjectStore for storing the events that are pending (re)processing. To execute until-successful asynchronously the threading profile defined on it must have doThreading attribute set with true value. To execute until-successful synchronously the threading profile defined on it must have doThreading attribute set with false value.


Field Summary
static String PROCESS_ATTEMPT_COUNT_PROPERTY_NAME
           
 
Fields inherited from class org.mule.routing.outbound.AbstractOutboundRouter
enableCorrelation, initialised, logger, replyTo, resultsHandler, routes, started, transactionConfig
 
Fields inherited from class org.mule.processor.AbstractMuleObjectOwner
flowConstruct, muleContext
 
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.api.AnnotatedObject
PROPERTY_NAME
 
Constructor Summary
UntilSuccessful()
           
 
Method Summary
 String getAckExpression()
           
 Object getDeadLetterQueue()
           
 MessageProcessor getDlqMP()
           
 String getEventKeyPrefix()
           
 String getFailureExpression()
           
 ExpressionFilter getFailureExpressionFilter()
           
 int getMaxRetries()
           
 ListableObjectStore<MuleEvent> getObjectStore()
           
 MessageProcessor getRoute()
           
 AbstractOutboundRouter getRouter()
           
 long getSecondsBetweenRetries()
           
 ThreadingProfile getThreadingProfile()
           
 void initialise()
          Method used to perform any initialisation work.
 boolean isMatch(MuleMessage message)
          Determines if the event should be processed
protected  MuleEvent route(MuleEvent event)
           
 void setAckExpression(String ackExpression)
           
 void setDeadLetterQueue(Object deadLetterQueue)
           
 void setFailureExpression(String failureExpression)
           
 void setMaxRetries(int maxRetries)
           
 void setObjectStore(ListableObjectStore<MuleEvent> objectStore)
           
 void setSecondsBetweenRetries(long secondsBetweenRetries)
           
 void setSynchronous(boolean synchronous)
           
 void setThreadingProfile(ThreadingProfile threadingProfile)
           
 void start()
           
 void stop()
           
 
Methods inherited from class org.mule.routing.outbound.AbstractOutboundRouter
addRoute, cloneMessage, cloneMessage, createEventToRoute, dispose, getEnableCorrelation, getMuleContext, getOwnedMessageProcessors, getReplyTo, getResultsHandler, getRoute, getRouterStatistics, getRoutes, getTransactionConfig, isDynamicRoutes, process, propagateMagicProperties, removeRoute, sendRequest, sendRequestEvent, setEnableCorrelation, setEnableCorrelationAsString, setMessageProcessors, setMessageProperties, setReplyTo, setResultsHandler, setRouterStatistics, setRoutes, setTransactionConfig
 
Methods inherited from class org.mule.processor.AbstractMessageProcessorOwner
addMessageProcessorPathElements, getAnnotation, getAnnotations, getOwnedObjects, setAnnotations
 
Methods inherited from class org.mule.processor.AbstractMuleObjectOwner
getFlowConstruct, setFlowConstruct, setMuleContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mule.routing.UntilSuccessfulConfiguration
getFlowConstruct, getMuleContext
 
Methods inherited from interface org.mule.api.context.MuleContextAware
setMuleContext
 
Methods inherited from interface org.mule.api.construct.FlowConstructAware
setFlowConstruct
 

Field Detail

PROCESS_ATTEMPT_COUNT_PROPERTY_NAME

public static final String PROCESS_ATTEMPT_COUNT_PROPERTY_NAME
See Also:
Constant Field Values
Constructor Detail

UntilSuccessful

public UntilSuccessful()
Method Detail

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
Overrides:
initialise in class AbstractOutboundRouter
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 AbstractOutboundRouter
Throws:
MuleException

stop

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

isMatch

public boolean isMatch(MuleMessage message)
                throws MuleException
Description copied from interface: Matchable
Determines if the event should be processed

Specified by:
isMatch in interface Matchable
Parameters:
message - the current message to evaluate
Returns:
true if the event should be processed by this router
Throws:
MuleException - if the event cannot be evaluated

route

protected MuleEvent route(MuleEvent event)
                   throws MessagingException
Specified by:
route in class AbstractOutboundRouter
Throws:
MessagingException

getObjectStore

public ListableObjectStore<MuleEvent> getObjectStore()
Specified by:
getObjectStore in interface UntilSuccessfulConfiguration
Returns:
an ObjectStore to store until successful internal data. Always returns a not null value.

setObjectStore

public void setObjectStore(ListableObjectStore<MuleEvent> objectStore)

getMaxRetries

public int getMaxRetries()
Specified by:
getMaxRetries in interface UntilSuccessfulConfiguration
Returns:
the number of retries to process the route when failing. Default value is 5.

setMaxRetries

public void setMaxRetries(int maxRetries)

getSecondsBetweenRetries

public long getSecondsBetweenRetries()
Specified by:
getSecondsBetweenRetries in interface UntilSuccessfulConfiguration
Returns:
the number of seconds between retries. Default value is 60.

setSecondsBetweenRetries

public void setSecondsBetweenRetries(long secondsBetweenRetries)

getFailureExpression

public String getFailureExpression()

setFailureExpression

public void setFailureExpression(String failureExpression)

getAckExpression

public String getAckExpression()
Specified by:
getAckExpression in interface UntilSuccessfulConfiguration
Returns:
the expression that will define the returned payload after the until successful route execution.

setAckExpression

public void setAckExpression(String ackExpression)

setDeadLetterQueue

public void setDeadLetterQueue(Object deadLetterQueue)

getDeadLetterQueue

public Object getDeadLetterQueue()

getEventKeyPrefix

public String getEventKeyPrefix()

getFailureExpressionFilter

public ExpressionFilter getFailureExpressionFilter()
Specified by:
getFailureExpressionFilter in interface UntilSuccessfulConfiguration
Returns:
ExpressionFilter to determine if the message was processed successfully or not. Always returns a not null value.

setThreadingProfile

public void setThreadingProfile(ThreadingProfile threadingProfile)

getThreadingProfile

public ThreadingProfile getThreadingProfile()
Specified by:
getThreadingProfile in interface UntilSuccessfulConfiguration
Returns:
threading profile to executes message processing inside until successful. Always returns a not null value.

getDlqMP

public MessageProcessor getDlqMP()
Specified by:
getDlqMP in interface UntilSuccessfulConfiguration
Returns:
the route to which the message must be sent if the processing fails.

getRoute

public MessageProcessor getRoute()
Specified by:
getRoute in interface UntilSuccessfulConfiguration
Returns:
the route to which the message should be routed to. Always returns a not null value.

getRouter

public AbstractOutboundRouter getRouter()
Specified by:
getRouter in interface UntilSuccessfulConfiguration
Returns:
the until sucessful router instance.

setSynchronous

public void setSynchronous(boolean synchronous)


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