This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • Custom DataFormat

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

Custom DataFormat

You can use your custom Data Format implementation with Camel. All you have to do is to implement the DataFormat interface. For example in the following we will implement a reverse data format as shown below:

Wiki Markup
{snippet:id=e2|title=Custom implementation of DataFormat that reverses data|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/impl/}

And to use it in Java DSL:

Wiki Markup

Notice we use custom to refer to the Data Format in the Registry. In Java DSL you can also provide the instance directly as shown:

Code Block
    .marshal(new MyReverseDataFormat())

And likewise to use it in XML DSL:

Wiki Markup

Notice in the XML DSL example above we use <custom> to refer to a custom data format. This requires Camel 2.8 or better. In older releases you would have to use the ref attribute as shown below. Notice the ref attribute has been @deprecated and you should prefer to use the <custom> way:

Code Block
 <marshal ref="reverse"/>
Include Page
Endpoint See Also
Endpoint See Also