allthingssecurity commented on code in PR #28035:
URL: https://github.com/apache/camel/pull/28035#discussion_r4306582692


##########
components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java:
##########
@@ -914,6 +982,13 @@ protected boolean isMatched(
             if (!isMatched(file, doneFileName, files)) {
                 return false;
             }
+
+            // a done file kept for files left by the last poll only admits 
these files, not the ones written after it
+            GenericFileDoneFileAdmission admission = getDoneFileAdmission();
+            if (admission != null && !admission.isAdmitted(doneFileName, 
absoluteFilePath)) {

Review Comment:
   You are right, thanks. The gate turned the common Camel-to-Camel setup into 
a stranding case, and the PR description even listed it as a "limit". I dropped 
the gate in e47aeb82b34e: while the done file is kept, the polls consume every 
file of the directory, as main does whenever the done file is there. The 
bookkeeping now only decides whether the done file is kept, not which files are 
admitted. I went with dropping it rather than the timestamp check, because of 
the minute resolution on FTP that you mentioned, and because main already 
consumes files written after the done file.
   
   New test `testFileWrittenByCamelProducerWhileFilesAreLeftIsConsumed`: with 
`maxMessagesPerPoll=1`, the route writes x.txt through 
`file:...?doneFileName=ready` (so `writeDoneFile` deletes and rewrites `ready`) 
while a.txt is routed. a, b, c and x are all consumed, and `ready` is deleted 
after the last one. It fails on the previous commit (`Expected: <4> but was: 
<3>`), and on main too (`<1>`). The former gate test is now 
`testFileWrittenWhileFilesAreLeftIsConsumed` and expects x to be consumed.
   
   _Claude Code on behalf of allthingssecurity_
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to