Hi Claus,
Thanks for the help. But when i try to run my code its throwing
the following exception
Exception in thread "main" 2011-05-31 20:44:29,313 [Thread-1 ] INFO
MainSupport$HangupInterceptor - Received hang up - stopping the main
instance.
org.apache.camel.CamelException: Cannot find any Camel Context from the
Application Context. Please check your Application Context setting
at
org.apache.camel.impl.MainSupport.postProcessContext(MainSupport.java:371)
at org.apache.camel.spring.Main.doStart(Main.java:144)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
at org.apache.camel.impl.MainSupport.run(MainSupport.java:136)
at camelinaction.FinalCSVParser.main(FinalCSVParser.java:56)
Given below is my code. Can you please let me know where i'm going wrong??
public class FinalCSVParser {
public static void main(String[] args) throws Exception {
Main main = new Main();
main.enableHangupSupport();
main.setApplicationContextUri("META-INF/spring/camel-context.xml") ;
main.addRouteBuilder(new RouteBuilder() {
public void configure() throws Exception {
from("file:src/data?delay=10000&noop=true")
.unmarshal().bindy(BindyType.Csv,
"camelinaction")
.process(new Processor(){
public void process(Exchange
exchange) throws
Exception {
List listin =
exchange.getIn().getBody(List.class);
List<PurchaseOrder>
listout = new
ArrayList<PurchaseOrder>();
System.out.println(listin.size());
int i = 0;
for (i=0;
i<listin.size(); i++){
Map row =
(Map) listin.get(i);
System.out.println(row.size());
listout.add((PurchaseOrder)row.get(PurchaseOrder.class.getName()));
}
System.out.println(listout.size());
exchange.getIn().setBody(listout);
}
})
.split(body())
.to("jpa:camelinaction.PurchaseOrder");
}
});
main.run();
}
}
Thanks in advance.
--
View this message in context:
http://camel.465427.n5.nabble.com/File-Poller-tp4435442p4442309.html
Sent from the Camel - Users mailing list archive at Nabble.com.