You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "web_nabble@sunilsamuel.com" <we...@sunilsamuel.com> on 2016/01/27 15:32:01 UTC
dataformat:// Component with JSON [reposting in Users]
NOTE: I am not sure if I've been posting in the wrong section (Development),
so I am reposting on Users.
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-reposting-in-Users-tp5776820.html
Sent from the Camel - Users mailing list archive at Nabble.com.