public class Foreach extends AbstractMessageProcessorOwner implements org.mule.runtime.api.lifecycle.Initialisable, Processor
foreach Processor 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 #[mel:variable:counter] and the root message is store in
#[mel:flowVars.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 Event sent to the next message processor is the same that arrived to foreach.
ReactiveProcessor.ProcessingType| Modifier and Type | Field and Description |
|---|---|
static String |
COUNTER_PROPERTY |
protected org.slf4j.Logger |
logger |
static String |
ROOT_MESSAGE_PROPERTY |
flowConstruct, messagingExceptionHandler, muleContext| Constructor and Description |
|---|
Foreach() |
| Modifier and Type | Method and Description |
|---|---|
protected Event |
doProcess(Event event) |
protected List<Processor> |
getOwnedMessageProcessors() |
void |
initialise() |
Event |
process(Event event)
Invokes the MessageProcessor.
|
void |
setBatchSize(int batchSize) |
void |
setCollectionExpression(String expression) |
void |
setCounterVariableName(String counterVariableName) |
void |
setMessageProcessors(List<Processor> messageProcessors) |
void |
setRootMessageVariableName(String rootMessageVariableName) |
getOwnedObjectsdispose, getFlowConstruct, getMuleContext, setFlowConstruct, setMessagingExceptionHandler, setMuleContext, start, stopgetAnnotation, getAnnotations, getLocation, setAnnotationsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetProcessingTypesetMuleContextsetFlowConstructpublic static final String ROOT_MESSAGE_PROPERTY
public static final String COUNTER_PROPERTY
protected org.slf4j.Logger logger
public Event process(Event event) throws org.mule.runtime.api.exception.MuleException
Processorprotected Event doProcess(Event event) throws org.mule.runtime.api.exception.MuleException, MessagingException
org.mule.runtime.api.exception.MuleExceptionMessagingExceptionprotected List<Processor> getOwnedMessageProcessors()
getOwnedMessageProcessors in class AbstractMessageProcessorOwnerpublic void setMessageProcessors(List<Processor> messageProcessors) throws org.mule.runtime.api.exception.MuleException
org.mule.runtime.api.exception.MuleExceptionpublic void initialise()
throws org.mule.runtime.api.lifecycle.InitialisationException
initialise in interface org.mule.runtime.api.lifecycle.Initialisableinitialise in class AbstractMuleObjectOwner<Processor>org.mule.runtime.api.lifecycle.InitialisationExceptionpublic void setCollectionExpression(String expression)
public void setBatchSize(int batchSize)
public void setRootMessageVariableName(String rootMessageVariableName)
public void setCounterVariableName(String counterVariableName)
Copyright © 2003–2017 MuleSoft, Inc.. All rights reserved.