You can choose which service is used at runtime by looking up service endpoints from a database, or with information from the message itself.
Dynamic routing is enabled by the Use dynamic endpoint property in the callout node that sets the callout to be dynamic. When the dynamic callout is invoked, it checks the /headers/SMOHeader/Target/address element in the message header for a service endpoint address, and routes the message to the address of that endpoint. If no address exists in the target address element, a service will be selected statically, if an import is wired to the associated reference of the callout in the mediation flow component. By default, the Use dynamic endpoint is enabled.
The target address element in the message header can be updated in a number of ways. You can use a Database Lookup primitive to retrieve a service endpoint from a database and place the retrieved URI directly into the target address element of the message. Or, you can use a Message Element Setter or Custom Mediation primitive to process the message and update the target address.
Follow these steps to create a mediation flow that uses a Database Lookup primitive to query a database and set the target endpoint address in the message header. .
The following image shows an example mediation
flow using the Database Lookup primitive.
The following example shows the properties of the Database
Lookup primitive: