Hi,

I am using polling consumer pattern to read all files in defined directory : 

public List<GenericFile> scanFolder(String folder) {
List<GenericFile> result = new ArrayList<GenericFile>();
String endpointUrl  = "file:////" + folder +
"?sendEmptyMessageWhenIdle=true&noop=true"
PollingConsumer pConsumer =
camelContext.getEndpoint(endpointUrl).createPollingConsumer();

pConsumer.start();

GenericFile<File> gFile;

 do {
     Exchange ex = pConsumer.receive(SCAN_TIMEOUT);
     gFile = (GenericFile<File>) ex.getIn().getBody();
     if(gFile != null) {
         result.add(gFile);
     }
  } while(gFile != null); //empty message is sent when endpoint is idle

 pConsumer.stop();

}

This works fine but as I am calling this method repeatedly Camel caches all
files in fileRepository (noop=true enforces idempotent=true) and result is
empty. I am using noop=true because this needs to work with read-only
filesystem. Is there a better way how to create 'folder scanner' using
polling consumer pattern which will read full folder content eachtime ?




--
View this message in context: 
http://camel.465427.n5.nabble.com/repeated-reading-from-read-only-directory-noop-true-idempotent-false-tp5767338.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to