public class MessageEnricher extends AbstractMessageProcessorOwner implements NonBlockingMessageProcessor
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.htmlModifier and Type | Class and Description |
---|---|
static class |
MessageEnricher.EnrichExpressionPair |
flowConstruct, messagingExceptionHandler, muleContext
PHASE_NAME
PHASE_NAME
PHASE_NAME
PHASE_NAME
PROPERTY_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, setAnnotations
dispose, getFlowConstruct, getMessagingExceptionHandler, getMuleContext, initialise, setFlowConstruct, setMessagingExceptionHandler, setMuleContext, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initialise
dispose
setMuleContext
setFlowConstruct
public MuleEvent process(MuleEvent event) throws MuleException
MessageProcessor
process
in interface MessageProcessor
event
- MuleEvent to be processedMuleException
protected 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 AbstractMessageProcessorOwner
public void addMessageProcessorPathElements(MessageProcessorPathElement pathElement)
MessageProcessorContainer
addMessageProcessorPathElements
in interface MessageProcessorContainer
addMessageProcessorPathElements
in class AbstractMessageProcessorOwner
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.