A typical ServiceMix EIP route exposes a service that consumes exchanges from the NMR. The route also defines one or more target destinations, to which exchanges are sent. In the Fuse Mediation Router environment, the exposed ServiceMix service maps to a consumer endpoint and the ServiceMix target destinations map to producer endpoints. The Fuse Mediation Router consumer endpoints and producer endpoints are both defined using endpoint URIs.
When migrating endpoints from ServiceMix EIP to Fuse Mediation Router, you must express the ServiceMix services/endpoints as Fuse Mediation Router endpoint URIs. You can adopt one of the following approaches:
Connect to an existing ServiceMix service/endpoint through the ServiceMix Camel module (which integrates Fuse Mediation Router with the NMR).
If the existing ServiceMix service/endpoint represents a ServiceMix binding component, you can replace the ServiceMix binding component with an equivalent Fuse Mediation Router component (thus bypassing the NMR).
The integration between Fuse Mediation Router and ServiceMix is provided by the
servicemix-camel
module. This module is provided with ServiceMix, but
actually implements a plug-in for the Fuse Mediation Router product: the JBI
component (see JBI in EIP Component Reference and
JBI Component).
To access the JBI component from Fuse Mediation Router, make sure that the
servicemix-camel
JAR file is included on your Classpath or, if you are using
Maven, include a dependency on the servicemix-camel
artifact in your project
POM. You can then access the JBI component by defining Fuse Mediation Router endpoint URIs with the
jbi:
component prefix.
ServiceMix defines a flexible format for defining URIs, which is described in detail in ServiceMix URIs. To translate a ServiceMix URI into a Fuse Mediation Router endpoint URI, perform the following steps:
If the ServiceMix URI contains a namespace prefix, replace the prefix by its corresponding namespace.
For example, after modifying the ServiceMix URI,
service:test:messageFilter
, wheretest
corresponds to the namespace,http://progress.com/demos/test
, you getservice:http://progress.com/demos/test:messageFilter
.Modify the separator character, depending on what kind of namespace appears in the URI:
If the namespace starts with
http://
, use the/
character as the separator between namespace, service name, and endpoint name (if present).For example, the URI,
service:http://progress.com/demos/test:messageFilter
, would be modified toservice:http://progress.com/demos/test/messageFilter
.If the namespace starts with
urn:
, use the:
character as the separator between namespace, service name, and endpoint name (if present).For example,
service:urn:progress:com:demos:test:messageFilter
.
Create a JBI endpoint URI by adding the
jbi:
prefix.For example,
jbi:service:http://progress.com/demos/test/messageFilter
.
For example, consider the following configuration of the static recipient list pattern in ServiceMix
EIP. The eip:exchange-target
elements define some targets using the ServiceMix
URI format.
<beans xmlns:sm="http://servicemix.apache.org/config/1.0" xmlns:eip="http://servicemix.apache.org/eip/1.0" xmlns:test="http://progress.com/demos/test" > ... <eip:static-recipient-list service="test:recipients" endpoint="endpoint"> <eip:recipients> <eip:exchange-target uri="service:test:messageFilter" /> <eip:exchange-target uri="service:test:trace4" /> </eip:recipients> </eip:static-recipient-list> ... </beans>
When the preceding ServiceMix configuration is mapped to an equivalent Fuse Mediation Router configuration, you get the following route:
<route> <from uri="jbi:endpoint:http://progress.com/demos/test/recipients/endpoint"/> <to uri="jbi:service:http://progress.com/demos/test/messageFilter"/> <to uri="jbi:service:http://progress.com/demos/test/trace4"/> </route>
Instead of using the Fuse Mediation Router JBI component to route all your messages through the ServiceMix NMR, you can use one of the many supported Fuse Mediation Router components to connect directly to a consumer or a producer endpoint. In particular, when sending messages to an external endpoint, it is more efficient to send the messages directly through a Fuse Mediation Router component than sending them through the NMR and a ServiceMix binding.
For details of all the Fuse Mediation Router components that are available, see EIP Component Reference and Fuse Mediation Router Components.