Wiki Spaces
Mantle Business Artifacts
Moqui Applications
Moqui Community
Moqui Framework
Page Tree
Moqui Framework


All Pages

Enterprise Integration with Apache Camel

Apache Camel ( is a tool for routing and processing messages with tools for Enterprise Integration Patterns which are described here (and other pages on this site have much other good information about EIP):

Moqui Framework has a Message Endpoint for Camel (MoquiServiceEndpoint) that ties it to the Service Facade. This allows services (with type=camel) to send the service call as a message to Camel using the MoquiServiceConsumer. The endpoint also includes a message producer (MoquiServiceProducer) that is available in Camel routing strings as moquiservice.

Here are some example Camel services from the ExampleServices.xml file:

<service verb="localCamelExample" type="camel"
 <in-parameters><parameter name="testInput"/></in-parameters>
 <out-parameters><parameter name="testOutput"/></out-parameters>
<service verb="targetCamelExample">
 <in-parameters><parameter name="testInput"/></in-parameters>
 <out-parameters><parameter name="testOutput"/></out-parameters>
 <set field="testOutput" value="Here's the input: ${testInput}"/>
 <log level="warn"
 message="targetCamelExample testOutput: ${result.testOutput}"/>

When you call the localCamelExample service it calls the targetCamelExample service through Apache Camel. This is a very simple example of using services with Camel. To get an idea of the many things you can do with Camel the components reference is a good place to start:

The general idea is you can:

  • get message data from a wide variety of sources (file polling, incoming HTTP request, JMS messages, and many more)
  • transform messages (supported formats include XML, CSV, JSON, EDI, etc)
  • run custom expressions (even in Groovy!)
  • split, merge, route, filter, enrich, or apply any of the other EIP tools
  • send message(s) to endpoint(s)

Camel is a very flexible and feature rich tool so instead of trying to document and demonstrate more here I recommend these books:

  • Instant Apache Camel Message Routing by Bilgin Ibryam

  • Apache Camel Developer's Cookbook by Scott Cranton and Jakub Korab

  • Camel in Action by Claus Ibsen and Jonathan Anstey

    • This is the classic book on Apache Camel. It covers general concepts, various internal details, how to apply the various EIPs, and a summary of many of the components. The web site for this book also has links to a bunch of useful online resources.