Camels can be stubborn and angry animals if you don’t take care of them. Lucky for you the EXTOL development team has figured out how to tame them. And we even taught them how to work with data!
Everywhere we look today we can see patterns. They’re in your shirt or tie. You witness traffic patterns (big or small) on your way to work. There are even patterns of integration – Enterprise Integration Patterns (EIP). These patterns allow you to define standard ways of dealing with messaging systems. Examples of these patterns include content-based routing and wiretapping.
Camel is a powerful integration framework that uses Enterprise Integration Patterns (EIP) to provide routing and mediation services. It can be used to handle various transports (JMS, HTTP, file, etc) and supports a full spectrum of patterns. It is available as a service engine for us to plug into our JBI-based server. We’ll use Camel for consuming JBI message exchanges and executing patterns to send messages to different sub-systems. For instance, you can use a wiretap to archive incoming data from a certain trading partner.
Camel can be configured with a Spring XML configuration or in plain Java code. The definition of a route starts with the <code>from</code> endpoint. This is the entrance point of the message you are working with. We can receive a message from any type of transport, but since we are inside of a JBI container it’s best to work with the Normalized Message Router.
A from route in Spring XML will look like so:
<from uri=”jbi:endpoint:http://extol.com/global/widgeCompanyQueue” />
A route can be defined to have a processor that is Java code written to work with the incoming message. Your class must implement the Camel Processor interface which defines a <code>process</code> method. Within this method you’ll be able to work with the message exchange to retrieve headers and other various properties.
After running the processor (if defined), the route should include a <code>to</code> section. This is what determines the messages exchange’s next destination after any processing is completed. You’ll often find that the <code>to</code> sections are wrapped in an EIP definition.
A very common pattern is multicast:
<to uri=”jbi:endpoint:http://extol.com/service/widgetCompanyLog” />
<to uri=”jbi:endpoint:http://extol.com/worker/widgeCompanyProcess” />
This brief article only touches the tip of the sand dune when it comes to Camel. It is a very powerful and extensible framework that can be used for many different projects. Much like the JBI service engines and binding components, EXTOL will be providing graphical tooling so that you need not worry about many of the details. However, the capability to wrangle with your camels in the sand still exists.