You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by shekher awasthi <sh...@gmail.com> on 2011/07/25 14:41:14 UTC

Camel POC example behaving strange

Hi All,

i am working on a POC to use camel in our system so for starting i am trying
to send csv data from one systenm to our internal system which accept only
XML format.
i am adopting following path

fetching the csv data and marshal the csv in to java using camel build in
mechanism and than convert the java list in to xml using XStream

here is my POC code

*

public* *class* TestPOC {

*public* *static* *void* main(String args[]) *throws* Exception {

CamelContext context = *new* DefaultCamelContext();

context.addRoutes(*new* RouteBuilder() {

*public* *void* configure() {

System.*out*.println("configure--");

from("file:data/csv?noop=true").unmarshal().csv().bean(*new
*

CSVConverterBean(),"processCSVInvoice").to("xslt:XMLConverter.xsl").to(
"file:data/csvoutput?fileName=test11.xml");

}

 });

context.start();

Thread.*sleep*(10000);

System.*out*.println("*********************************");

context.stop();

}



csv file looks like this

Quantity,Price,Total,Date,ID,Name,Ref#
4,1.13,4.52,9/4/2008,275,Blue Ink,49385730
5,2.16,2.16,8/3/2008,229,Red Ink,20549348
3,0.40,1.20,7/14/2008,6234,SomeMore gasket,20349584



and my bean is
*

public* *class* CSVConverterBean {

*public* String processCSVInvoice(@Body List<List<String>> data){

XStream xstream = *new* XStream();

String myTest=xstream.toXML(data);

System.*out*.println(myTest);

*return* "hello";

}



now it is behaving very strange which i am unable to figure out till now

system is printing the output XML 18 times on console and i have no idea why
it is doing so, can any one help me what exactly is going wrong or what i
have done wrong which forcing system to behave like this



thanks in advance