org.mule.enricher
Class MessageEnricher
java.lang.Object
org.mule.processor.AbstractMuleObjectOwner<MessageProcessor>
org.mule.processor.AbstractMessageProcessorOwner
org.mule.enricher.MessageEnricher
- All Implemented Interfaces:
- AnnotatedObject, FlowConstructAware, MuleContextAware, Disposable, Initialisable, Lifecycle, Startable, Stoppable, MessageProcessor
public class MessageEnricher
- extends AbstractMessageProcessorOwner
- implements MessageProcessor
The 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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.mule.api.lifecycle.Startable |
start |
Methods inherited from interface org.mule.api.lifecycle.Stoppable |
stop |
MessageEnricher
public MessageEnricher()
process
public MuleEvent process(MuleEvent event)
throws MuleException
- Description copied from interface:
MessageProcessor
- Invokes the MessageProcessor.
- Specified by:
process
in interface MessageProcessor
- Parameters:
event
- MuleEvent to be processed
- Returns:
- optional response MuleEvent
- Throws:
MuleException
enrich
protected void enrich(MuleMessage currentMessage,
MuleMessage enrichmentMessage,
String sourceExpressionArg,
String targetExpressionArg,
ExpressionManager expressionManager)
setEnrichmentMessageProcessor
public void setEnrichmentMessageProcessor(MessageProcessor enrichmentProcessor)
setMessageProcessor
public void setMessageProcessor(MessageProcessor enrichmentProcessor)
- For spring
setEnrichExpressionPairs
public void setEnrichExpressionPairs(List<MessageEnricher.EnrichExpressionPair> enrichExpressionPairs)
addEnrichExpressionPair
public void addEnrichExpressionPair(MessageEnricher.EnrichExpressionPair pair)
getOwnedMessageProcessors
protected List<MessageProcessor> getOwnedMessageProcessors()
- Specified by:
getOwnedMessageProcessors
in class AbstractMessageProcessorOwner
Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.