davsclaus commented on code in PR #30535:
URL: https://github.com/apache/camel/pull/30535#discussion_r4651900966
##########
components/camel-atom/src/main/docs/atom-component.adoc:
##########
@@ -110,6 +110,9 @@ YAML::
The default Idempotency strategy uses Atom published and updated timestamps to
identify already
read entries, by filtering all entries older that the _last read_ entry.
+So that no entry is skipped, the consumer routes the entries with this
strategy from the oldest to the newest updated
+date (the published date for an entry without an updated date), as with
`sortEntries=true`, and an entry with the same
+date as the _last read_ entry is told apart by its id (the `atom:id`, else its
link).
Review Comment:
Split into two sentences and changed to "distinguished" in 503937ca4d9b. The
catalog copy is updated too.
_Claude Code on behalf of Claus Ibsen_
##########
components/camel-atom/src/main/java/org/apache/camel/component/atom/ItemUpdatedIdempotentStrategy.java:
##########
@@ -43,17 +47,37 @@ public boolean isValidItem(Item item) {
LOG.debug("No updated time for entry so assuming its valid:
entry=[{}]", item);
return true;
}
+ String id = idOf(item);
if (lastUpdate != null) {
// we need to skip the latest updated entry
- if (lastUpdate.after(updated) || lastUpdate.equals(updated)) {
+ if (lastUpdate.after(updated)) {
LOG.debug("Entry is older than lastupdate=[{}], no valid
entry=[{}]", lastUpdate, item);
return false;
}
+ if (lastUpdate.equals(updated)) {
+ // entries published or updated in the same second (or with a
date without a time) are told apart by
Review Comment:
Changed to "distinguished" in 503937ca4d9b.
_Claude Code on behalf of Claus Ibsen_
##########
components/camel-atom/src/test/java/org/apache/camel/component/atom/ItemUpdatedIdempotentStrategyTest.java:
##########
@@ -114,4 +114,24 @@ void testEntryWithEqualDate() throws ParseException {
// Second item is invalid because it has the same updated date
assertFalse(strategy.isValidItem(item2));
}
+
+ @Test
+ void testEntriesWithEqualDateAndDifferentIds() {
Review Comment:
Added `testEntriesWithEqualDateAndNoIdAreDistinguishedByTheirLink` in
503937ca4d9b. Both entries have no `atom:id` and are told apart by their link.
_Claude Code on behalf of Claus Ibsen_
##########
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc:
##########
@@ -6306,6 +6306,19 @@ older entry was updated after newer ones were published.
Routes using `sortEntries=true` with `idempotent=false` get the entries in
this order too: the entry that was updated
first is routed first, where the entry that was published last was routed
first before.
+=== camel-atom - the default idempotent strategy routes every new entry of a
feed
+
+With the default options (`idempotent=true` with the default strategy, which
skips an entry that is not newer than
+the one routed before it, and `sortEntries=false`), the `atom` consumer routed
the entries in the order of the feed
+reader, the newest published first, from the end. An entry that was updated
after newer entries were published (an
Review Comment:
Split in 503937ca4d9b: the default options are now in their own sentence.
_Claude Code on behalf of Claus Ibsen_
--
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]