gnodet-bot commented on code in PR #30535:
URL: https://github.com/apache/camel/pull/30535#discussion_r4649596196


##########
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:
   💬 **Style:** The three added lines form a single sentence of ~58 words. 
Consider splitting it for readability — the doc paragraph already ends cleanly 
at line 113 and the new content is non-trivial. Also, "told apart" is 
non-standard; "distinguished" is clearer.
   
   ```suggestion
   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`. An entry with the same date as 
the
   _last read_ entry is distinguished by its id (the `atom:id`, else its link).
   ```



##########
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:
   💬 **Style:** The first paragraph opens with a ~45-word sentence. Consider 
splitting at the natural break after "from the end." to keep lines scannable in 
the upgrade guide.
   
   ```suggestion
   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.
   ```



##########
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:
   💬 **Test gap:** `testEntriesWithEqualDateAndDifferentIds` only exercises the 
`getGuid()` path. The `idOf()` method falls back to `item::getLink` when 
`getGuid()` returns empty — that path is untested. Consider adding a second 
case where `getGuid()` returns `Optional.empty()` and `getLink()` provides the 
distinguishing value.



##########
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:
   💬 **Nit:** "told apart" → "distinguished" (consistent with standard English 
and aligns with the phrasing in other Apache Camel docs).
   
   ```suggestion
                   // entries published or updated in the same second (or with 
a date without a time) are distinguished by
   ```



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