Sunday, November 30, 2008

A Message Compressor/Decompressor for messages sent using Camel routes

There is tremendous value in message compression of XML based payloads as they are dispatched to remote endpoints utilizing Camel as a mediation router.

Camel supports marshalling and unmarshalling of messages into and out of several different data formats such as JAXB, JSON, HL7 etc. An ability to map a message from XML into a compressed data format such as (ZLIB, GZIP, PKZIP) etc can offer significant advantages with respect to network performance and storage in exchange for a small added cost of message compression.

The messages marshalled using zip compression can be unmarshalled using zip decompression just prior to being consumed at the endpoint. The true value of applying compression during a camel route is that it requires no changes to the source or destination application. Compression takes place just after the message leaves the source application and is picked up by the Camel message listener. The message exchange can now be forwarded/routed via several endpoints in a camel flow. Ideally, the message need be uncompressed only when it arrives at its final destination.

I have implemented this feature/capability and made a submission to the Camel community. I believe this capability is invaluable when you deal with large XML and Text based payloads.

The way this feature is designed to work in Camel is as follows

Example 1: Message Compression

RouteBuilder builder = new RouteBuilder() {
public void configure() {
from("http:www.foo.com/orders")
.marshal().zip(Deflater.BEST_COMPRESSION)
.to("activemq:queue:ORDERS")
}
};


Example 1: Message Decompression

RouteBuilder builder = new RouteBuilder() {
public void configure() {
from("activemq:queue:ORDERS")
.unmarshal().zip()
.bean((MyOrderProcessor.class);
}
};


I hope you like this feature and use it judiciously in an enterprise environment that utilizes Camel as a mediation layer to route messages to their ultimate destinations as a compact set of payloads.

Please find my submission to the Apache community here

https://issues.apache.org/activemq/browse/CAMEL-1133

Monday, November 10, 2008

Easing development in Servicemix 4 using Archetypes

I recently submitted maven archetypes to the Apache Servicemix community for adding ease of use in Servicemix 4 in the following areas
  • An OSGi based Camel maven archetype to ease development of Camel routes for deployment in the Servicemix 4 OSGi container (servicemix-osgi-camel-service-unit)
  • A CXF WSDL first maven archetype to ease development of WSDL first web services (servicemix-osgi-cxf-wsdl-first-service-unit)
  • An CXF Code first archetype to ease development of Code first web services (servicemix-osgi-cxf-code-first-service-unit)

If you are interested in using these archetypes check out the following jira issues at the Apache Servicemix community site. These fixes will be committed into the upcoming release of Servicemix 4.