I am working on replacing data in file (it's big file of 400 MB) using camel and I am facing issue where other consumer pickup file even though file is in use (it's in writing mode).
Is there a way in Camel to lock file which is in writing mode so another consumer/route can't consume. It should consume once the writing is done. I tried with readLocks but no luck so far.
from("file://A").split().tokenize("\n", 999).streaming()
.log("Spliting::::::::::").unmarshal(csv).bean("transferDate", "enrich")
.marshal(csv).to("file://B?fileExist=Append");
from("file://B?delete=true").to("file://A"); // this route pick up file even the first route haven't finished writing file completely