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


##########
components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/mongodb/gridfs/GridFsConsumer.java:
##########
@@ -51,6 +51,10 @@ public class GridFsConsumer extends DefaultConsumer 
implements Runnable {
     private final GridFsEndpoint endpoint;
     private volatile ScheduledExecutorService taskExecutor;
     private volatile ExecutorService executor;
+    // the upload date of the newest file that was routed: a poll only asks 
for the files uploaded after it.
+    // Kept between the polls. Two threads use it: run() sets the start value 
on the thread of the executor,
+    // before it schedules the polls; the polls then read and move it on the 
thread of the taskExecutor.
+    private volatile Date fromDate;

Review Comment:
   Not intended, thanks. On main the attribute strategies query from the start 
date at every poll, and before 3.13 (one
   loop with a local `fromDate`) they moved the date like the plain strategies. 
I kept the main behaviour for them: done
   in f2671c53c1ca. A poll now uses a local copy of the date; only `TimeStamp` 
and `PersistentTimestamp` (no attribute)
   write it back to the field, as each routed file moves it. 
`TimeStampAndFileAttribute` and
   `PersistentTimestampAndFileAttribute` keep the start date in the query, and 
their stored timestamp is written as on
   main. The upgrade-guide entry now also says that `TimeStamp` and 
`PersistentTimestamp` skip a file whose upload date is
   older than one already routed (as before 3.13), and points to the attribute 
strategies for that case.
   
   New tests in `GridFsConsumerTimestampTest` (the fake bucket now also 
evaluates the attribute filter, and a fake files
   collection marks a file as the consumer asks): for both attribute 
strategies, a file `newer` is routed, then a file
   `older` with an earlier `uploadDate` becomes visible and must be routed too; 
for `TimeStamp` the same sequence routes
   only `newer`. With the consumer of the previous commit the two attribute 
tests fail (`expected: <[newer, older]> but was: <[newer]>`).
   camel-mongodb-gridfs: 6 run, 0 failures.
   
   _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