urunni88 opened a new pull request, #28361:
URL: https://github.com/apache/camel/pull/28361

   # Description
   
   Fixes [CAMEL-26060](https://issues.apache.org/jira/browse/CAMEL-26060).
   
   The file-watch consumer set the `CamelFileLastModified` header to the time 
of the event, while its documentation says it is the last modified timestamp of 
the file. The consumer now reads the last modified time of the file with 
`Files.getLastModifiedTime`. When the file no longer exists (such as for a 
DELETE event), the header is not set, and its documentation now says so. 
`Exchange.MESSAGE_TIMESTAMP` is still the time of the event.
   
   Behavior change: for a DELETE event the header was set to the time of the 
event, and is now not set. I can add a note to the 4.24 upgrade guide if you 
prefer.
   
   The header description changed, so the generated `file-watch.json` of the 
component and its copy in camel-catalog are updated.
   
   Test: the new `FileWatchComponentTest.testLastModifiedHeaderIsTimeOfFile` 
creates a file outside the watched directory with the last modified time 
2020-01-01, moves it in, and checks the header of the CREATE event. Before the 
change it fails with the time of the event (`expected: <1577836800000> but was: 
<1792764495271>`); after the change it passes. All camel-file-watch tests pass 
locally (`FileWatchComponentDeleteTest` is skipped on Windows).
   
   Not included: the ticket also notes that an event is dropped without a log 
when the event queue is full. I left that out to keep this change focused, and 
can do it in a follow-up.
   
   This PR was prepared with AI assistance (Claude); I reviewed and tested all 
changes.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [x] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.


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