Skip to content
Art2link ESB v2.02 LTS HomeDocumentationBlogContact
Patterns/Routing/Dynamic router

Dynamic router

When the destination is not one of a fixed set but something worked out per message — looked up from a partner table, derived from the content — the address itself becomes data. A dynamic router resolves it at runtime and sends there.

A content-based router chooses among destinations you defined ahead of time. A dynamic router computes the destination: a custom function or lookup resolves an endpoint address into a variable, and a dynamic send port uses that variable as its target. Add a new partner endpoint by adding a row to the lookup — no new port, no redeploy.

message partner = P42 Resolve endpoint lookup → variable endpoint table Dynamic send port target = {variable} P42 endpoint

The endpoint is computed, but everything else still belongs at the boundary: authentication stays on the port, and a key that resolves to nothing must route to a dead-letter channel rather than failing silently.

In Art2link the routing stays one broad subscription; the address is what varies. The send port picks up the message type, resolves the endpoint in Variables On Entry — a lookup keyed on a promoted value such as {{Promoted.Order.PartnerId}}, typically through a custom function — and the adapter’s address field reads that variable:

ADAPTER ADDRESSsend port
{{Variable.endpointUrl}}

One port serves every partner; the destination is computed per message rather than wired into a fixed branch. Contrast the content-based router, where the branches are fixed and the message picks one.

Resolve from configuration, not code. Keep the address map in an externalized table so adding or moving an endpoint never reopens the flow — the router reads the new row and routes accordingly.