Dynamic invocation of endpoints can be enhanced using target import bindings.
Dynamic invocation with a target import uses a service that is invoked using a supported import binding. The import and its binding must already be available within the module, and is selected at runtime according to information contained in the message.
You can use WebSphere® Integration Developer to create a mediation module that selects the target service dynamically at runtime. The target services might use different protocols, different formats or different quality-of-service values. Each combination must be known at the time the mediation module is developed. This means that for each combination of protocol, format, and quality-of-service value, WebSphere Integration Developer includes an import in the mediation module with an appropriate configuration.
For example, one MQ accesses one target service and a JMS queue accesses another target service. A quality-of-service example might be where one import uses security, but another import does not. The choice between the target service destinations is made dynamically at runtime using available metadata. Imports for both the services would have to be included in the mediation module by WebSphere Integration Developer.
WebSphere Integration Developer includes logic in the mediation module to retrieve endpoint URIs dynamically at runtime. The message passing through the mediation module provides an endpoint URI, and an associated target import name. The import name identifies one of the imports within the mediation module that has the appropriate binding. The target import name could also be identified from the metadata associated with the endpoint, the endpoint URI itself, or stored in the same location as the endpoint URIs, although in general it would not appear directly in the WebSphere Service Registry and Repository (WSRR).
When the invocation occurs, an Endpoint Reference (EPR) is provided containing the endpoint URI and a target import name. If a target import name is provided, and the endpoint URI is compatible with the named import binding, the named import and the relevant qualifiers are used to invoke the target service. If the endpoint URI is not compatible with the import binding, a runtime error occurs.
A target import name always takes precedence over an existing wired import within the mediation module, even if the target URI is compatible with the wired import binding but not the target import binding.