The first talk of day 2 I attended, was about integration. Integration frameworks comes into play when you have to integrate between different technologies (JDBC, HTTP, JMS) or different message formats (XML, EDI, CSV, etc.). Charles Moulliard presented this session in which he discussed a bundle of Apache licensed products used to enable integration:
- Apache Camel: java-based routing and mediation engine;
- Apache CXF: web services framework (SOAP/REST);
- Apache ActiveMQ: message broker, a JMS implementation;
- Apache ServiceMix: an open source ESB, based on JBI (Java Business Integration).
Apache Camel
Camel is introduced as an open source integration framework enabling the implementation of Enterprise Integration Patterns (EIP). It has the following features:
- Contrary to a lot of integration frameworks that are out there, with Camel one is able to implement all EIP patterns;
- Supports Java DSL and Spring based XML configuration to transpose EIP patterns into Java;
- It’s an in-memory bus;
- Routes objects (XML, Stream, File, Bytes);
- Transactional;
- Supports Sync/Async exchanges;
- Threads management;
- Error and Exception Handling.
Routing is implemented via Java DSL (Domain Specific Language). Here is an example for integrating 2 endpoints (A and B) and using a filter in between.
public class FilterRoute extends RouteBuilder {
public void configure throws Exception {
Endpoint A = endpoint("activemq:queue:quote");
Endpoint B = endpoint("mq:quote");
Predicate isWidget = xpath("/quote/product = 'widget'");
from(A).filter(isWidget).to(B);
}
}
You can also build a oneliner inside the method that accomplishes the same thing:
from(endpoint("activemq:queue:quote")).filter().xpath("/quote/product = 'widget'").to(endpoint("mq:quote"));
Java DSL is currently supported by all the major IDEs (Netbeans, IntelliJ and Eclipse). When using an IDE you have the added advantage of code completion. You lose this advantage when you switch to Spring XML configuration.
Apache CXF
CXF is a webservices framework designed to simplify the creation and deployment of webservices. It’s a merge of 2 previous frameworks, XFire (an Apache Axis competitor) and Celtic. CXF provides the following features:
- It has java2wsdl and wsdl2java generation capabilities;
- Supports JAX-WS, JAX-RS, SOAP, WSDL, WS-Security, WS-ReliableMessaging, WS-Addressing;
- Maven plugin cxf-codegen-plugin for code generation (wsdl2java);
- it uses a spring configuration file for setting specific generation properties;
- it generates java classes with JAXB and JAX-WS annotations.
Apache ActiveMQ
The routing done in Apache Camel is all in-memory. This means that exchanges can become lost. Sometimes this is not very desirable. For those situations ActiveMQ provides the solution.
ActiveMQ is based on JMS and supports point-to-point messaging (JMS Queue, one sender, one receiver) as well as publish/subscribe (JMS Topic, one publisher, zero to many subscribers).
Apache ServiceMix
Apache ServiceMix is an ESB and supports the exchange of messages and objects between a range of transport layers. It has the following characteristics:
- provides connectors (endpoints) for receiving messages and sending them on the bus;
- separation of business logic and messaging logic;
- based on JBI;
- uses a Normalized Message Router. Components are never directly coupled, there’s the router in between, which uses a Normalized (based on XML) Message format. This format is a combination of metadata, payload and attachments.
Since the JBI standard is a dead standard, ServiceMix had deviated from it and added additional functionality:
- Modularity based on OSGI (ServiceMix4 can use Felix or Equinox as the OSGI kernel);
- Adopted Camel as the new routing engine.
Apache Karaf
At this point Apache Karaf is introduced. Karaf is a lightweight container to which Java applications, Camel Routes and CXF services can be deployed. It has an OSGI run-time and supports Apache Felix and Eclipse Equinox. It’s also the heart of Apache ServiceMix. If you don’t need ESB or NMR features, Karaf is basically all you need. Furthermore, because it’s a modular container you can choose which options you really need. For example, you can choose only to activate Camel and CXF and do without ActiveMQ.
Apache Karaf has the following characteristics:
- Admin console is available;
- Supports hot deployment and configuration management;
- Security integration (JAAS);
- Logging management (log4j, Logger, commons logging, etc.).
Fuse IDE
Fuse IDE is an Eclipse based IDE with built-in support for Apache Camel, ServiceMix, and ActiveMQ. It offers the following:
- A graphic editor for Camel routes (a graphical representation of the camel-context.xml file, the Spring XML way of defining routes);
- Run-time views and statistics of deployed routes;
- JMX explorer;
- Drag-and-drop of test messages to deployed routes;
- And a lot more.
Fuse Fabric
Fuse Fabric is a piece of software that makes it a lot easier to configure, package and deploy the aforementioned applications, be it an Apache ServiceMix project or an Apache Camel route:
- It helps you with getting the OSGI dependencies right by making use of the Maven dependencies;
- It also eases deployment to clouds;
- With Fabric you can create and manage instances (Karaf or ServiceMix) locally, remotely (ssh) or in the cloud;
- Provides a registry (service and profile repository), based on Apache ZooKeeper;
- Adds an agent to server instances which can act upon these instances by profiles;
- A profile is a list of tasks for an agent to do.
Conclusion
With all the ingredients mentioned above almost any integration challenge can be tackled and any service architecture can be realized. ServiceMix also supports high availability via clustering and master/slave replication. For more information on some of the possible architectures see the slides mentioned in the References section.
References
- Blog Charles Moulliard
- Slides
- Slides (Not the ones from Devoxx)
- Hands on lab


Whitehorses is specialized in succesfully implementing Oracle SOA solutions: BPEL, OSB, WebLogic & BPM