Search code examples
apache-camelcamel-ftp

How make sure that CAMEL-file is read by only one server?


I am using camel-jcifs and reading a file. Every thing works fine. The application will be deployed on four server instance. Now my query is how can I make sure only one server picks up the file at a time?

 <from id="_from_pop3" uri="smb://myurl?fileName=filename&amp;preMove=inprogress&amp;move=processed"/>

I got suggestion to use infinispan and write to shared cache that the file in progress.

Can someone please suggest other possible solutions?

Regards, Sarada.


Solution

  • Yes you would need to use a clustered route pattern. You can find details about this in the Camel in Action 2nd edition book, chapter 17: https://www.manning.com/books/camel-in-action-second-edition

    As camel-jcifs extends the file component you can look at the solutions there is online about clustered file routes in Apache Camel and use similar solution. For example the readLockIdempotent option (there is an example in the book).