camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fachhoch <>
Subject Re: read all files in folder
Date Fri, 10 Jun 2011 23:20:55 GMT
thank u very much , I also tried a simple approach it worked but not sure if 
it is right please tell  me if it is right , what I did is  call
convertBodyTo(String.class)  and I noticed exchange has headers and it had
file path filename and some other values so I just called get header  
Exchange.FILE_NAME it worked .I get the body and   file name of my file.
here is the code

public class MyRouteBuilder extends RouteBuilder {

    public void configure() {
    			.process(new FileProcessor())


    public static class FileProcessor implements  Processor {
		public void process(Exchange exchange) throws Exception {
			System.out.println("from process");
			ArrayList<Exchange> grouped =
exchange.getProperty(Exchange.GROUPED_EXCHANGE, ArrayList.class); 
			for(Exchange exch :grouped){
//				File file=exch.getIn().getBody(File.class);
//				System.out.println(exch.getProperty(Exchange.FILE_LOCAL_WORK_PATH));
//				//byte[]  filebytes=IOUtils.toByteArray(new FileInputStream(file));
//				System.out.println("name"+file.getName());

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message