= CBOR DataFormat
:doctitle: CBOR
:shortname: cbor
:artifactid: camel-cbor
:description: Unmarshal a CBOR payload to POJO and back.
:since: 3.0
:supportlevel: Stable
//Manually maintained attributes
:camel-spring-boot-name: cbor

*Since Camel {since}*

CBOR is a Data Format which uses the
https://github.com/FasterXML/jackson/[Jackson library] with the
https://github.com/FasterXML/jackson-dataformats-binary/tree/master/cbor[CBOR extension]
to unmarshal a CBOR payload into Java objects or to marshal Java objects
into a CBOR payload.

[source,java]
-------------------------------
from("activemq:My.Queue").
  unmarshal().cbor().
  to("mqseries:Another.Queue");
-------------------------------

== CBOR Options

// dataformat options: START
include::partial$dataformat-options.adoc[]
// dataformat options: END

=== Using CBOR in Spring DSL

When using Data Format in Spring DSL you need to
declare the data formats first. This is done in the *DataFormats* XML
tag.

[source,xml]
-----------------------------------------------------------------------------------------------------------------------------
<dataFormats>
    <!-- here we define a CBOR data format with the id test and that it should use the TestPojo as the class type when
    doing unmarshal. -->
    <cbor id="test" unmarshalType="org.apache.camel.component.cbor.TestPojo"/>
</dataFormats>
-----------------------------------------------------------------------------------------------------------------------------

And then you can refer to this id in the route:

[source,xml]
-------------------------------------
<route>
    <from uri="direct:back"/>
    <unmarshal><custom ref="test"/></unmarshal>
    <to uri="mock:reverse"/>
</route>
-------------------------------------

== Dependencies

[source,java]
-------------------------------------
<dependency>
   <groupId>org.apache.camel</groupId>
   <artifactId>camel-cbor</artifactId>
   <version>x.x.x</version>
</dependency>
-------------------------------------


include::spring-boot:partial$starter.adoc[]
