Section 1 About Servicemix 4. Even though there are many open source ESB projects, not all of them are mature enough to be used to solve enterprise mission critical integration problems. ServiceMix is one of the open source projects that is mature enough to be used in these scenarios. ServiceMix, an Apache project, has been around for a couple of years now. It provides all the features you expect from an ESB such as routing, transformation, etc. Section 2 Servicemix 4.
|Published (Last):||25 February 2016|
|PDF File Size:||17.78 Mb|
|ePub File Size:||17.70 Mb|
|Price:||Free* [*Free Regsitration Required]|
It offers all the functionality one would expect from a commercial ESB — but in contrast to most commercial counterparts, at its core it is truly based on open standards and specifications. ServiceMix leverages a number of very popular open source projects. Its excellent message routing capabilities are based on the Apache Camel framework. Apache Camel is a lightweight integration framework that uses standard Enterprise Integration Patterns EIP for defining integration routes using a variety of domain specific languages DSL.
The majority of integration projects require a reliable messaging infrastructure. It offers a long list of messaging features, can be scaled to thousands of clients and supports many Clustering and High Availability broker topologies. An OSGi bundle is a plain Java jar file that contains additional OSGi specific meta data information about the classes and resources contained inside the jar.
The OSGi runtime used in ServiceMix is Apache Karaf , which offers many interesting features like hot deployment, dynamic configuration of OSGi bundles at runtime, a centralized logging system, remote management via JMX and an extensible shell console that can be used to manage all aspects of an OSGi runtime. Using Karaf one can manage all life cycle aspects of the deployed application modules individually.
The flexible deployment options ease the migration of existing Java applications to OSGi. This further reduces the already small runtime memory footprint of ServiceMix. Figure 1 summarizes the technologies and standards that Apache ServiceMix is built on.
Each of these projects is based on open standards and industry specifications and designed to provide a maximum level of interoperability.
All of these aspects make ServiceMix a very popular ESB that is deployed in thousands of customer sites today and in many mission critical applications. There is also professional, enterprise level support available from companies like Red Hat who acquired FuseSource in and Talend. Larger projects may spawn multiple ServiceMix containers as one single JVM instance would not fit the entire application. In addition, the same application may be deployed to multiple ServiceMix containers for load balancing reasons.
However, managing a larger number of ServiceMix instances with dozens of applications deployed becomes a non trivial task as ServiceMix itself does not provide any tools to manage multiple ESB instances centrally. Installing updates of an application deployed to multiple independent OSGi containers becomes a tedious and error-prone task. It is necessary to manually log into each OSGi container e.
These steps then need to be repeated on all the remaining ESB instances that run the same application. If anything goes wrong during such upgrade, changes need to be reverted back manually.
This manual approach is cumbersome and chances are high that mistakes are made along the way. With Fuse Fabric you can group all ServiceMix container instances into one or several clusters, so called Fabrics. All instances of this cluster can then be managed from a central location, which potentially may be any ServiceMix instance within the Fabric. This includes both the configuration of all ESB instances in a cluster as well as the deployment of applications to each ServiceMix container.
It also supports deploying applications to both private and public clouds. Using the jclouds library, all major cloud providers are supported.
Applications may be deployed to the cloud with a single Karaf shell command and even the virtual machine in the cloud can be started by Fabric.
Fabric can also create ESB containers on-demand. Not only can it create new ESB containers locally sharing the existing installation of ServiceMix but it can also start new ESB containers on remote machines that do not even have ServiceMix pre-installed.
Using ssh, Fabric is capable of streaming a full ServiceMix installation to a remote machine, unpacking and starting that ServiceMix installation and provision it with pre-configured applications. Fabric concepts Fabric defines a couple of components that work together to offer a centralized integration platform. Each Fabric contains one or more Fabric Registries. A Fabric Registry is an Apache Zookeeper -based, distributed and highly-available configuration service which stores the complete configuration and deployment information of all ESB containers making up the cluster in a configuration registry.
The data is stored in a hierarchical tree-like structure inside Zookeeper. ESB containers get provisioned by Fabric based on the information stored in the configuration registry.
There is also a runtime registry that stores details of the physical ESB instances making up the Fabric cluster, their physical locations and the services they are running. The runtime registry is used by clients to discover available services dynamically at runtime.
The Fabric Registry can be made highly available by running replica instances. The example cluster in Figure 2 consists of three ESB instances that each run a registry replica. Fabric Registries store all configuration and deployment information of all ESB instances.
This information is described in Fabric Profiles, where users fully describe their applications and the necessary configuration in these profiles. Profiles therefore become high level deployment units in Fabric and specify which OSGi bundles, plain Java jar or war files, what configuration and which Bundle Repositories a particular application or application module requires.
Profiles are versioned, support inheritance relationships, and are managed using a set of Karaf shell commands. It is possible to describe common configuration or deployment information in a base profile that other more specific profiles inherit from. Figure 3 shows some example profiles that are provided out-of-the-box. It defines a common base profile called default that all other profiles inherit from.
The example also lists profiles named camel, mq or cxf. Users are encouraged to create their own profile that inherit from these standard profiles.
Deploying a profile to a particular container is the task of the Fabric Agent. There is an agent running on each ESB container in the Fabric cluster. It connects to the Fabric Registry and evaluates the set of profiles it needs to deploy to its container. The agent further listens for changes to profile definitions and provisions the changes immediately to its container.
This is every ESB container that is managed by Fabric. Each Fabric Server has a Fabric Agent running. For true location transparency Fabric also defines a number of Fabric Extensions.
Each CXF based Web Service, each Camel consumer endpoint the start endpoint of a Camel integration route and each ActiveMQ message broker instance can register its endpoint address in the Fabric runtime registry at start up.
Clients can query the registry for these addresses at runtime rather than having the addresses hard-coded. Fabric Extensions are outside the scope of this article but the link above explains them in full detail. Fabric defines some really powerful concepts. All provisioning information is stored in a highly available Fabric Registry in form of Fabric profiles. These profiles can then be deployed quickly to any number of ESB instances inside the cluster thanks to the Fabric Agents.
Also, Fabric is capable of creating new local and remote ESB instances on demand. Together with the Fabric Extensions this allows for very flexible deployments. If the load of a particular ESB container increases it is possible to start up another ESB container instance perhaps in the cloud that deploys the same set of applications and then load balance the overall work across all instances.
Furthermore ESB instances can be moved to different physical servers if there is a need to run on faster hardware while clients automatically get rebalanced.
With Fuse Fabric it is possible to quickly and easily adapt on any changes to your runtime requirements and have a fully flexible integration platform. Walkthrough Having introduced the concepts of Fabric, this last section aims to provide a quick introduction on how to practically use Fuse Fabric for deploying an integration project. It is fully documented here.
The default workflow when working with Fabric is as follows: Create a new Fabric. This starts the Fabric Registry and imports the default profiles. Define the deployment of the application plus its configuration in one or more Fabric Profiles.
Create the required number of ESB containers and configure these containers for one or many profiles. Test or run the deployed application.
Lets go through these steps one by one. A few seconds later the welcome screen of the shell console is displayed. On its first start up this ESB container does not have a Fabric pre-configured. This reconfigures the current ESB container, deploys and starts the Fabric registry and imports the default profiles into the registry.
ESB functions get enabled by deploying the relevant profiles. The demo works in a plain ServiceMix environment but in this part it will be deployed to a Fabric enabled ESB container. It then logs the file name and sends the content of the file to the incomingOrders queue on an external ActiveMQ broker.
Depending on the XML payload of the message it gets routed to different target directories on the local file system. This is a simple yet fairly common integration use-case. Some small additional configuration is needed to tell Camel how to connect to the external ActiveMQ broker. That way the broker can be moved to a different physical machine and clients automatically reconnect to the new broker address.
This will install the generated OSGi bundle to the local Maven repository. For running an ActiveMQ broker there is already a profile with the name mq provided out of the box. That ActiveMQ broker has a default configuration, which is sufficient for running this demo. The mq profile can simply be re-used so there is no need to create a new profile. Furthermore, both Camel routes connect to the external ActiveMQ broker.
The profile camel deploys the core Camel runtime but not the many Camel components. Finally the profile camel-jms has two parent profiles named camel and activemq-client, so it deploys both of the ActiveMQ client libraries — the Camel core runtime and camel-jms component. When using the profile camel-jms as a parent, it will automatically deploy the Camel runtime and ActiveMQ client runtime.
Thanks to the out-of-the-box profiles it took only two Fabric shell commands to create a profile that fully deploys the Camel integration demo. It also deploys the mq profile, which runs the ActiveMQ broker. With the broker running its time to deploy the camel-jms-demo profile to another ESB container. The existing root container only runs the Fabric Registry so the demo can be deployed to the root container using the command fabric:container-add-profile camel-jms-demo root This reconfigured the root container to also deploy the camel-jms-demo profile the jms demo.
Fortunately some sample messages are provided with the demo.
To ServiceMix or Not to ServiceMix
Getting Started with Apache Camel The Enterprise Integration Patterns EIP book The purpose of a patterns book is not to advocate new techniques that the authors have invented, but rather to document existing best practices within a particular field. By doing this, the authors of a patterns book hope to spread knowledge of best practices and promote a vocabulary for discussing architectural designs. Since the publication of Design Patterns, many other pattern books, of varying quality, have been written. It is common for people to refer to this book by its initials EIP. As the subtitle of EIP suggests, the book focuses on design patterns for asynchronous messaging systems. The book discusses 65 patterns.
Hello World with Camel and ServiceMix. part 1.
In my mind the short answer is: NO Guillaume Nodet one of the key architects and long time committer on Apache ServiceMix already had his mind set 3 years ago when he wrong this blog post - Thoughts about ServiceMix. That happened in spring , which Guillaume also blogged about. So is all that bad? No its IMHO all great.