Appendix A. Migrating from ServiceMix EIP


Abstract

If you are currently an Apache ServiceMix 3.x user, you might already have implemented some Enterprise Integration Patterns using the ServiceMix EIP module. It is recommended that you migrate these legacy patterns to Apache Camel, which has more extensive support for Enterprise Integration Patterns. After migrating, you can deploy your patterns into a Red Hat JBoss Fuse container.

A.1. Migrating Endpoints

Overview

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 Apache Camel environment, the exposed ServiceMix service maps to a consumer endpoint and the ServiceMix target destinations map to producer endpoints. The Apache Camel consumer endpoints and producer endpoints are both defined using endpoint URIs.
When migrating endpoints from ServiceMix EIP to Apache Camel, you must express the ServiceMix services/endpoints as Apache Camel endpoint URIs. You can adopt one of the following approaches:
  • Connect to an existing ServiceMix service/endpoint through the ServiceMix Camel module (which integrates Apache Camel with the NMR).
  • If the existing ServiceMix service/endpoint represents a ServiceMix binding component, you can replace the ServiceMix binding component with an equivalent Apache Camel component (thus bypassing the NMR).

The ServiceMix Camel module

The integration between Apache Camel and ServiceMix is provided by the servicemix-camel module. This module is provided with ServiceMix, but actually implements a plug-in for the Apache Camel product: the JBI component (see and JBI Component).
To access the JBI component from Apache Camel, 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 Apache Camel endpoint URIs with the jbi: component prefix.

Translating ServiceMix URIs into Apache Camel endpoint URIs

ServiceMix defines a flexible format for defining URIs, which is described in detail in ServiceMix URIs. To translate a ServiceMix URI into a Apache Camel endpoint URI, perform the following steps:
  1. 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, where test corresponds to the namespace, http://progress.com/demos/test, you get service:http://progress.com/demos/test:messageFilter.
  2. 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 to service: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.
  3. Create a JBI endpoint URI by adding the jbi: prefix.
    For example, jbi:service:http://progress.com/demos/test/messageFilter.

Example of mapping ServiceMix URIs

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 Apache Camel 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>

Replacing ServiceMix bindings with Apache Camel components

Instead of using the Apache Camel JBI component to route all your messages through the ServiceMix NMR, you can use one of the many supported Apache Camel 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 Apache Camel component than sending them through the NMR and a ServiceMix binding.
For details of all the Apache Camel components that are available, see and Apache Camel Components.
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.