If you want to select a single service endpoint from the WebSphere® Service
Registry and Repository (WSRR) using only the Endpoint Lookup mediation primitive,
then set the Match Policy property to return one matching endpoint.
When a single endpoint is retrieved from the registry, the endpoint
information is placed in both the Endpoint Lookup context and in the target
address element in the message header. If the Use dynamic endpoint property
of the callout node is checked, the message will be routed to the endpoint
in the target address element, and therefore no further processing is required
to select the endpoint.
Follow these steps to create an example mediation
flow that uses an Endpoint Lookup primitive to retrieve a service endpoint
from the WSRR and routes the message to the retrieved endpoint.
- Create a mediation flow component, and add a source interface and
a target reference that contains the operation that you wish to invoke
- In order for the runtime to implement dynamic routing on a request,
the callout node must be set to use the dynamic endpoint. Select the callout
node, and click on the details page in the properties view. Ensure that the
Use dynamic endpoint check box is selected.
- Optional: Promote the Use dynamic endpoint property so that
the administrator can change it at runtime. Click the Promoted properties
page, and select the promoted check box for the property.
- Drop an Endpoint Lookup primitive onto the mediation flow canvas,
and select the properties that you want to use to query the WSRR registry. At runtime, a single endpoint that matches the query will be retrieved
from the WSSR and placed in the target address element of the SMOHeader in
the message (/headers/SMOHeader/Target/address), and the message will be routed
to the URI specified in the address element, shown in the image below:

For valid URI formats
for the supported target types, see Dynamic endpoint example URIs.
- The message containing the retrieved endpoint information will
be propagated through the output terminal of the Endpoint Lookup primitive,
and no further mediation is required to select the endpoint. You can directly
wire the output terminal of the Endpoint Lookup to the callout node, or to
another primitive to perform the next processing step of your flow.
- Optional: Promote the query properties of Endpoint Lookup,
such as User properties, so that you can change the query to the registry
at runtime without redeploying the mediation module.
- Optional: You can specify a default endpoint that the
runtime uses if it cannot find a dynamic endpoint. For example:
- Wire an import to a reference in the mediation flow editor, and wire the
noMatch terminal to the corresponding node in the mediation flow editor.
- Wire the noMatch terminal to another primitive (such as MessageSetter
or Custom Mediation) which updates the /headers/smoHeaders/target/address
element with the next location. Enable dynamic lookup on the callout node.
- Optional: If there are no endpoints matching the search
criteria in the WSRR, the message is propagated to the noMatch terminal of
the Endpoint Lookup primitive. You can wire the noMatch terminal to a mediation
primitive for notification, such as an Event Emitter.
Example: The following image shows an example mediation
flow when match policy is return one matching endpoint.