In this chapter, we will cover:
In this chapter, we will be looking at a few of the ways that Camel allows you to transform or change the content of messages being processed. The book Enterprise Integration Patterns by Gregor Hohpe and Bobby Woolf defines the responsibility of translating data from one format to another within the Message Translator pattern (http://www.enterpriseintegrationpatterns.com/MessageTranslator.html). This is what Camel has based its transformation capabilities on.
In this chapter we will explore a number of ways in which Camel performs message content transformation:
transform
statement. This allows you to reference Camel Expression Language code within the route to do message transformations.beanref
), defined by you, within a Camel route to perform the transformation. This is a special case processor that can invoke any referenced Java object method.String
to int
, or File
to String
. Data Formats are used to translate between a low-level representation (XML) and a high-level one (Java objects). Other examples include encrypting/decrypting data, and compressing/decompressing data. For more, see http://camel.apache.org/data-format.html.A number of Camel architectural concepts are used throughout this chapter. There is a broader overview of Camel concepts in the Preface. Full details can be found at the Apache Camel website at http://camel.apache.org.
The code for this chapter is contained within the camel-cookbook-transformation
module of the examples.
3.133.150.41