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

   # Description
   
   [CAMEL-27288](https://issues.apache.org/jira/browse/CAMEL-27288)
   
   Since 4.21 the `atom` consumer is idempotent by default (CAMEL-23220) with 
`ItemUpdatedIdempotentStrategy`, which skips an entry whose updated (or 
published) date is not after the date of the entry routed before it. Without 
`sortEntries` (the default) the entries are routed in the order of the feed 
reader, the newest published first, from the end of the list. So with the 
default options:
   
   - An entry that was updated after newer entries were published (an edited 
post) was routed first, and every newer entry with an earlier updated date was 
skipped, in that poll and in all later polls. With the existing 
`src/test/data/edited-feed.atom` one poll routed 1 of the 4 entries.
   - An entry with the same date as the entry routed before it (several entries 
published in the same second, or dates without a time) was skipped for good: of 
three entries with the same date one was routed.
   
   Nothing is logged above DEBUG. CAMEL-25549 (#27696) fixed the order for 
`sortEntries=true` only.
   
   Fix:
   - `AtomEntryPollingConsumer` sorts the entries by their updated date (as 
`sortEntries=true` does since CAMEL-25549) also without `sortEntries` when the 
consumer is idempotent with `ItemUpdatedIdempotentStrategy`, the only order in 
which that strategy skips nothing. `idempotent=false` and other strategies 
(repository, custom) keep the order of the feed (tested).
   - `ItemUpdatedIdempotentStrategy` remembers the ids (the `atom:id`, which 
the feed reader gives as the guid, else the link) of the entries routed with 
the latest date: another entry with that date is routed once and then skipped 
like the others. An entry without id and link keeps the old behaviour (skipped 
when its date equals the last date), so the existing `testEntryWithEqualDate` 
is unchanged. The set holds only the entries of one date.
   - Option metadata unchanged (the `idempotent` description still holds); 
component page and catalog copy say how the default strategy orders and tells 
entries apart; the 4.24 upgrade guide has an entry after the CAMEL-25549 one, 
naming the order change for an edited entry.
   
   Not changed: the strategy keeps its date in memory, so a restarted consumer 
routes the feed again (as before).
   
   Tests: `AtomEntryDefaultIdempotencyTest` polls one consumer twice on file 
feeds with the default options: the edited feed must route all 4 entries 
(oldest updated first) and then none, a new feed with three entries of the same 
date must route the 3 and then none, and with `idempotent=false` the feed order 
is kept (control). 
`ItemUpdatedIdempotentStrategyTest.testEntriesWithEqualDateAndDifferentIds` 
checks the strategy alone. Runs (offline, rssreader 3.12.0): the 3 new tests 
fail on main (`[first, edited last]` routed of 4; 1 of 3 entries with the same 
date; second entry with the same date rejected), the control and the existing 
strategy tests pass; camel-atom module tests 42 run, 0 failures, 1 skipped; the 
two test classes 20 times in one JVM: 180 of 180.
   
   # 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): 
[CAMEL-27288](https://issues.apache.org/jira/browse/CAMEL-27288).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [ ] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
     (I built the core modules and camel-atom with the formatter and 
import-sort plugins, and copied the component page to the catalog. No option 
metadata changed. I did not run the full root build.)
   
   # 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 PR was prepared with Claude Code (Claude Opus 5.5). The commit 
carries a `Co-Authored-By` trailer.
   
   _Claude Code on behalf of allthingssecurity_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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