Skip to content
Art2link ESB v2.02 LTS HomeDocumentationBlogContact
Patterns/Transformation/Content enricher

Content enricher

Fill in what the source left out. A message arrives with an id but not the details a destination needs; the enricher looks the rest up and merges it into the canonical message.

There are two clean ways to enrich, and the difference matters. For data that is static or derivable — a country name from a code, a check digit, a category from a table baked into the platform — use a pure custom function inside the map. For live data that must be fetched from a system of record, do the lookup on a port via a caller adapter, not as a hidden call buried in a map.

thin message customerId only Enricher lookup & merge reference source enriched message + name, address, terms

Keeping live lookups on a port preserves everything the bus gives you: the call is visible, retryable and resilient, and a slow reference system does not freeze a map mid-transform. The opposite — a function quietly calling an API for every record — is exactly what keep custom functions pure warns against.

In Art2link, where the missing value is derivable, compute it in the map with a custom function — but call it the right way. A function that derives a value from the message has to read its inputs from the current node, so invoke it from the XSLT with art:invoke and pass the loop-context nodes as arguments — art:invoke('lineTotal', Quantity, UnitPrice) inside the template that matches each line. Do not feed it binding tokens like {{Promoted.Order.Qty}}: bindings are resolved by a preprocessor before the map runs, so they are not loop-aware — every iteration receives the same single pre-resolved value, not the value of the line being processed. Reserve the binding form for genuinely scalar, message-level inputs. Where the value is live reference data — a current price, a credit status — do not hide a fetch inside a map. Make it explicit: a two-way send port with a SQL Caller looks the value up and republishes the enriched message to the bus, where the rest of the flow picks it up.

Static vs live is the whole decision. Derivable from the data alone → custom function in the map. Needs a fresh read from another system → enrich on a port. Never hide a live call inside a map.