Hi

Probably better to just use the java file api to get a list of files

Something in the order of
String[] names = new File(dir).listNames();



On Wed, May 20, 2015 at 5:20 PM, martin.vich <mejlnas...@seznam.cz> wrote:
> 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.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Reply via email to