Enrichment
Vasanthi
Mule Enricher Component
• Enricher is used if the target system needs more information than the
source system can provide.
• It enriches the mule message by calling external system or do some
transformation to existing payload and save it into some scope of variable
like session or outbound or invocation and the transformation happened
in en-richer scope doesn't affect the actual payload.
• Set-property: Save some information extracted from payload or original
payload to some invocation or flow scope variable.
• NOTE: Mule currently supports enrichment of flow variables and message
headers only.
Example:
• Consider a message from a source system contains a zip code but the
target system needs the two letter state. A message enricher can be used
to lookup the state using the zip (postal code) from an enrichment
resource. The enricher calls out to the enrichment resource with the
current message (containing the zip code) then enriches the current
message with the result.
Example Flow:
• This is a very simple flow with one-way inbound and outbound endpoints,
and which acts as part of an order processing pipeline. This flow uses an
enricher to add a state flow variable to the current message with the state
that the flow ref returns. The ‘target’ attribute defines how the current
message is enriched using a MessageEnricher which uses the same syntax as
expression evaluators.
Description:
• 1. The http endpoint receives an xml input as a payload with H-No, street,
city and zip elements.
• 2. In message enricher we modified the payload as zip and forwarded the
same to sub flow to retrieve the state for that particular zip.
• 3. The flow reference in the processor chain of the enricher receives the
state as a payload which enricher assigns to a new target flow variable
named state.
• 4. The payload sent from the enricher is the same as the input payload and
the new state variable is added to the xml using Data-Mapper.
Output:
• The enricher element also supports more advanced use cases where the
message returned by the enrichment resource isn’t just a simple string
which is exactly what we need to enrich the current message with; often
you may want to enrich your message with just part of the information
from the result of the invocation of an external service.
More Complex Enrichment
• In this particular example the ‘Get State’ endpoint receives the full
message, and we are supposed to use a part of that payload. Here we
mention the part of the payload in the Source section of the Message
Enricher and that is saved in the target section.
• The “enrichment resource” can be any message processor, outbound
connector, processor-chain or flow-ref. If using an outbound-connector
then of course it should have a request-response exchange pattern.
•Thank You All

M enrichment

  • 1.
  • 2.
    Mule Enricher Component •Enricher is used if the target system needs more information than the source system can provide. • It enriches the mule message by calling external system or do some transformation to existing payload and save it into some scope of variable like session or outbound or invocation and the transformation happened in en-richer scope doesn't affect the actual payload.
  • 3.
    • Set-property: Savesome information extracted from payload or original payload to some invocation or flow scope variable. • NOTE: Mule currently supports enrichment of flow variables and message headers only. Example: • Consider a message from a source system contains a zip code but the target system needs the two letter state. A message enricher can be used to lookup the state using the zip (postal code) from an enrichment resource. The enricher calls out to the enrichment resource with the current message (containing the zip code) then enriches the current message with the result.
  • 4.
  • 5.
    • This isa very simple flow with one-way inbound and outbound endpoints, and which acts as part of an order processing pipeline. This flow uses an enricher to add a state flow variable to the current message with the state that the flow ref returns. The ‘target’ attribute defines how the current message is enriched using a MessageEnricher which uses the same syntax as expression evaluators.
  • 6.
    Description: • 1. Thehttp endpoint receives an xml input as a payload with H-No, street, city and zip elements. • 2. In message enricher we modified the payload as zip and forwarded the same to sub flow to retrieve the state for that particular zip. • 3. The flow reference in the processor chain of the enricher receives the state as a payload which enricher assigns to a new target flow variable named state. • 4. The payload sent from the enricher is the same as the input payload and the new state variable is added to the xml using Data-Mapper.
  • 7.
  • 8.
    • The enricherelement also supports more advanced use cases where the message returned by the enrichment resource isn’t just a simple string which is exactly what we need to enrich the current message with; often you may want to enrich your message with just part of the information from the result of the invocation of an external service. More Complex Enrichment
  • 9.
    • In thisparticular example the ‘Get State’ endpoint receives the full message, and we are supposed to use a part of that payload. Here we mention the part of the payload in the Source section of the Message Enricher and that is saved in the target section.
  • 10.
    • The “enrichmentresource” can be any message processor, outbound connector, processor-chain or flow-ref. If using an outbound-connector then of course it should have a request-response exchange pattern.
  • 11.