Writing a custom data type converter

If you find that you have written one or more processors that are just casting or converting from one data type to another, then writing a custom Camel Type Converter will help you reduce that boilerplate code. Camel attempts to automatically convert from one data type to another within a route, and allows you to extend its type converter registry with converters between known types.

The Type Converters are like cast operations in Java. If you want to do a more complex data format change, say from XML to JSON, then you should look at Chapter 4, Transformation, Camel's built in Data Format Marshallers (http://camel.apache.org/data-format.html), and the Writing a Custom Data Marshaller recipe.

This recipe will ...

Get Apache Camel Developer's Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.