0

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.

2 Answers2

0

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).

Claus Ibsen
  • 56,060
  • 7
  • 50
  • 65
0

can try to use premove option in file/ftp to move the file once it is found by the server this will hide the file from other server and also it obtains lock by default so other server cant access even if both tries at same nano second.