Hello,
I am trying to use the dataformat: component to unmarshal a JSON payload.
The following code works:
from("direct-vm:moxy-unmarshal-json")
.unmarshal("jsonDataformat");
I want to use dataformat: component in the following manner:
from("direct-vm:moxy-unmarshal-json")
.to("dataformat:jsonDataformat:unmarshal");
I have a blueprint bean defined as follows:
<bean id="jsonDataformat"
class="org.apache.camel.model.dataformat.JsonDataFormat">
<property name="unmarshalType" value="my.model.InputData" />
<property name="library" value="Jackson"/>
<property name="prettyPrint" value="true" />
</bean>
For some reason, this dataformat is not found with the
context.resolveDataFormat("jsonDataformat");
That is, the following code from
org.apache.camel.component.dataformat.createEndpoint () return null for df
below.
@Override
protected Endpoint createEndpoint(String uri, String remaining,
Map<String, Object> parameters) throws Exception {
String name = ObjectHelper.before(remaining, ":");
>>>> DataFormat df = getCamelContext().resolveDataFormat(name); <<<<
IS NULL
if (df == null) {
throw new IllegalArgumentException("Cannot find data format with
name: " + name);
}
But if I define an XML data format as follows:
<bean id="dataFormatCustomerEnrollXml"
class="org.apache.camel.converter.jaxb.JaxbDataFormat">
<argument ref="moxyCustomerEnrollXml" />
</bean>
And then use the dataformat: component, everything works fine.
Why is org.apache.camel.model.dataformat.JsonDataFormat not registered as a
dataFormat within the Camel Context?
I am using Camel 2.12.
Any help is greatly appreciated.
Thanks,
Sunil
--
View this message in context:
http://camel.465427.n5.nabble.com/dataformat-Component-with-JSON-tp5776757.html
Sent from the Camel Development mailing list archive at Nabble.com.