Hi All,

I am using typeconverter to transfrom my data into JsonArray.

Route:
 public void configure() {
                    from("direct:ab")
                        .setHeader(HTTP_URI, simple(baseUrl +
"/${header.aa}"))
                        .to("http://dummyhost";).
                }

template.requestBodyAndHeader("direct:ab",null,"aa",zip,JSONArray.class)

Converters simply transform the data to jsonArray.

Now i want to use Camel data format .So i have following questions:
1)When to use typeconverter versus dataformat
2)How to use dataformat?

I am trying use the data format by creating a processor

Route:
public void configure() {
                    from("direct:ab")
                       .setHeader(HTTP_URI, simple(baseUrl +
"/${header.aa}"))                      
.to("http://dummyhost";).unmarshal().json(JsonLibrary.Jackson).to("bean:com.xxx.MyMsgProcessor?method=process");
                }

My Message processor is 

 public void process(JSONArray data) {
        logger.info("We should slice and dice the data: " + data);
    }

Now i am getting following error in logs:
 at [Source:
org.apache.camel.converter.stream.CachedOutputStream$WrappedInputStream@30773b;
line: 1, column: 1] 
*com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize
instance of java.util.HashMap out of START_ARRAY token*
 at [Source:
org.apache.camel.converter.stream.CachedOutputStream$WrappedInputStream@30773b;
line: 1, column: 1]


Is it something i am doing wrong?



--
View this message in context: 
http://camel.465427.n5.nabble.com/DataFormat-Versus-TypeConverters-tp5747307.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to