public class MessageEnricher extends AbstractMessageProcessorOwner implements MessageProcessor, NonBlockingSupported
Message Enricher allows the current message to be augmented using data from a seperate
resource.
The Mule implementation the Enrichment Resource can be any Message Processor. This allows you to not
only use a JDBC endpoint directly but also call out to a remote service via HTTP or even reference another
flow or sub-flow.
The Message Processor that implements the Enrichment Resource is invoked with a copy of the current
message along with any flow or session variables that are present. Invocation of the this message processor
is done in a separate context to the main flow such that any modification to the message (and it's
properties and attachments) or flow or session variables will not be reflected in the flow where the
enricher is configured.
The Enrichment Resource should always return a result. If it doesn't then the Enricher will simply
leave the message untouched.
The way in which the message is enriched (or modified) is by explicitly configuring mappings (source ->
target) between the result from the Enrichment Resource and the message using of Mule Expressions. Mule
Expressions are used to both select the value to be extracted from result that comes back from the
enrichment resource (source) and to define where this value to be inserted into the message (target). The
default 'source' if it's not configured is the payload of the result from the enrichment resource..
EIP Reference: http://eaipatterns.com/DataEnricher.html| Modifier and Type | Class and Description |
|---|---|
static class |
MessageEnricher.EnrichExpressionPair |
flowConstruct, messagingExceptionHandler, muleContextPHASE_NAMEPHASE_NAMEPHASE_NAMEPHASE_NAMEPROPERTY_NAME| Constructor and Description |
|---|
MessageEnricher() |
| Modifier and Type | Method and Description |
|---|---|
void |
addEnrichExpressionPair(MessageEnricher.EnrichExpressionPair pair) |
void |
addMessageProcessorPathElements(MessageProcessorPathElement pathElement)
Add the child nodes to the path element tree.
|
protected void |
enrich(MuleMessage currentMessage,
MuleMessage enrichmentMessage,
String sourceExpressionArg,
String targetExpressionArg,
ExpressionManager expressionManager) |
protected List<MessageProcessor> |
getOwnedMessageProcessors() |
MuleEvent |
process(MuleEvent event)
Invokes the MessageProcessor.
|
void |
setEnrichExpressionPairs(List<MessageEnricher.EnrichExpressionPair> enrichExpressionPairs) |
void |
setEnrichmentMessageProcessor(MessageProcessor enrichmentProcessor) |
void |
setMessageProcessor(MessageProcessor enrichmentProcessor)
For spring
|
getAnnotation, getAnnotations, getOwnedObjects, setAnnotationsdispose, getFlowConstruct, getMessagingExceptionHandler, getMuleContext, initialise, setFlowConstruct, setMessagingExceptionHandler, setMuleContext, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinitialisedisposesetMuleContextsetFlowConstructpublic MuleEvent process(MuleEvent event) throws MuleException
MessageProcessorprocess in interface MessageProcessorevent - MuleEvent to be processedMuleExceptionprotected void enrich(MuleMessage currentMessage, MuleMessage enrichmentMessage, String sourceExpressionArg, String targetExpressionArg, ExpressionManager expressionManager)
public void setEnrichmentMessageProcessor(MessageProcessor enrichmentProcessor)
public void setMessageProcessor(MessageProcessor enrichmentProcessor)
public void setEnrichExpressionPairs(List<MessageEnricher.EnrichExpressionPair> enrichExpressionPairs)
public void addEnrichExpressionPair(MessageEnricher.EnrichExpressionPair pair)
protected List<MessageProcessor> getOwnedMessageProcessors()
getOwnedMessageProcessors in class AbstractMessageProcessorOwnerpublic void addMessageProcessorPathElements(MessageProcessorPathElement pathElement)
MessageProcessorContaineraddMessageProcessorPathElements in interface MessageProcessorContaineraddMessageProcessorPathElements in class AbstractMessageProcessorOwnerCopyright © 2003–2015 MuleSoft, Inc.. All rights reserved.