public class Foreach extends AbstractMessageProcessorOwner implements Initialisable, MessageProcessor, NonBlockingSupported
Foreach MessageProcessor allows iterating over a collection payload, or any collection
obtained by an expression, generating a message for each element.
The number of the message being processed is stored in #[variable:counter] and the root
message is store in #[variable:rootMessage]. Both variables may be renamed by means of
setCounterVariableName(String) and setRootMessageVariableName(String).
Defining a groupSize greater than one, allows iterating over collections of elements of the specified size.
The MuleEvent sent to the next message processor is the same that arrived to foreach.| Modifier and Type | Field and Description |
|---|---|
static String |
COUNTER_PROPERTY |
protected org.apache.commons.logging.Log |
logger |
static String |
ROOT_MESSAGE_PROPERTY |
flowConstruct, messagingExceptionHandler, muleContextPHASE_NAMEPHASE_NAMEPHASE_NAMEPHASE_NAMEPROPERTY_NAME| Constructor and Description |
|---|
Foreach() |
| Modifier and Type | Method and Description |
|---|---|
void |
addMessageProcessorPathElements(MessageProcessorPathElement pathElement)
Add the child nodes to the path element tree.
|
protected List<MessageProcessor> |
getOwnedMessageProcessors() |
void |
initialise()
Method used to perform any initialisation work.
|
MuleEvent |
process(MuleEvent event)
Invokes the MessageProcessor.
|
void |
setBatchSize(int batchSize) |
void |
setCollectionExpression(String expression) |
void |
setCounterVariableName(String counterVariableName) |
void |
setMessageProcessors(List<MessageProcessor> messageProcessors) |
void |
setRootMessageVariableName(String rootMessageVariableName) |
getAnnotation, getAnnotations, getOwnedObjects, setAnnotationsdispose, getFlowConstruct, getMessagingExceptionHandler, getMuleContext, setFlowConstruct, setMessagingExceptionHandler, setMuleContext, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdisposesetMuleContextsetFlowConstructpublic static final String ROOT_MESSAGE_PROPERTY
public static final String COUNTER_PROPERTY
protected org.apache.commons.logging.Log logger
public MuleEvent process(MuleEvent event) throws MuleException
MessageProcessorprocess in interface MessageProcessorevent - MuleEvent to be processedMuleExceptionprotected List<MessageProcessor> getOwnedMessageProcessors()
getOwnedMessageProcessors in class AbstractMessageProcessorOwnerpublic void addMessageProcessorPathElements(MessageProcessorPathElement pathElement)
MessageProcessorContaineraddMessageProcessorPathElements in interface MessageProcessorContaineraddMessageProcessorPathElements in class AbstractMessageProcessorOwnerpublic void setMessageProcessors(List<MessageProcessor> messageProcessors) throws MuleException
MuleExceptionpublic void initialise()
throws InitialisationException
InitialisableInitialisationException 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.initialise in interface Initialisableinitialise in class AbstractMuleObjectOwner<MessageProcessor>InitialisationException - if a fatal error occurs causing the Mule instance to shutdownRecoverableException - if an error occurs that can be recovered frompublic void setCollectionExpression(String expression)
public void setBatchSize(int batchSize)
public void setRootMessageVariableName(String rootMessageVariableName)
public void setCounterVariableName(String counterVariableName)
Copyright © 2003–2015 MuleSoft, Inc.. All rights reserved.