...
It is within the route definition that we declare the Input Type
and/or Output Type
. If the Input Type
and/or Output Type
are different from the message type at runtime, the camel internal processor looks for a Transformer. The role of the Transformer is to transform the current message type to the expected message type. Once the message is transformed successfully or if the message is already in the expected type, then the message data type is updated.
Supported Transformers
Transformer | Description |
---|---|
Data Format Transformer | Transforms by using Data Format |
Endpoint Transformer | Transforms by using Endpoint |
Custom Transformer | Transforms by using custom transformer class. |
...
Name | Description |
---|---|
scheme | Type of data model such as |
fromType | Data type to transform from. |
toType | Data type to transform to. |
Transformer Examples
Java DSL:
Code Block |
---|
BindyDataFormat bindy = new BindyDataFormat(); bindy.setType(BindyType.Csv); bindy.setClassType(com.example.Order.class); transformer() .fromType(com.example.Order.class) .toType("csv:CSVOrder") .withDataFormat(bindy); |
...
Code Block |
---|
<dataFormatTransformer fromType="java:com.example.Order" toType="csv:CSVOrder"> <bindy id="csvdf" type="Csv" classType="com.example.Order"/> </dataFormatTransformer> |
Customer Transformer
Examples to illustrate custom Transformer class:
...