camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "calyan.bandi" <calyan.ba...@gmail.com>
Subject Bindy dataformat usage in Spring v/s Java DSL
Date Wed, 21 Oct 2015 13:03:50 GMT
Hi,

I am working on a camel route that reads an excel and does some processing.
I had this written in Spring DSL as shown below.

<from uri="file:csv?fileName=orders1.csv&amp;noop=true" />
<unmarshal ref="bindyDataFormat" />
<camel:process ref="displayExchange"></camel:process>    	
<to uri="direct:writeToCSVFile" />

In the processor, the exchange body i received is
java.util.ArrayList<Order>. Using a simple iterator i was able to do my
processing. 

List<Order> orders = exchange.getIn().getBody(List.class);
for(Order order : orders)
{
  // simply reading the order object and doing processing
}


Recently, we moved to Java DSL and the code looks as below and below is how
we have our route written.

DataFormat bindy = new BindyCsvDataFormat("org.examples.camel.model");

from("file:csv?fileName=orders1.csv&noop=true")
		.unmarshal(bindy)
		.process(new Processor() {
                        .................
                 });

The exchange body that i have received in my processor is of type:
java.util.ArrayList<HashMap&lt;String, Object>>

Why is there a difference in the way the exchange body is created in both
the cases? The camel documentation for bindy data format -
http://camel.apache.org/bindy.html also tells that the exchange body will be
of type List<Map&lt;String, Object>> but this is not the case with Spring
DSL. 

Thanks,
Kalyan



--
View this message in context: http://camel.465427.n5.nabble.com/Bindy-dataformat-usage-in-Spring-v-s-Java-DSL-tp5772940.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message