camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shekher awasthi <shekher.awas...@gmail.com>
Subject Camel POC example behaving strange
Date Mon, 25 Jul 2011 12:41:14 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message