davsclaus commented on code in PR #27760:
URL: https://github.com/apache/camel/pull/27760#discussion_r4255595088


##########
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc:
##########
@@ -202,3 +202,10 @@ throttling): the failure of the first object is then the 
failure of the poll, an
 In both cases the objects are no longer kept in the `inProgressRepository`; 
before, the object (or a new object with
 the same key) was skipped by all later polls until the endpoint was restarted. 
With the `fileName` option, a failed
 get still fails the poll.
+
+=== camel-box

Review Comment:
   The 4.24 note was moved out of this PR to avoid guide conflicts between the 
open PRs; it is added to the guide on main in a follow-up commit, with this 
heading.
   
   _Claude Code on behalf of @davsclaus._



##########
components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxEventLogsManager.java:
##########
@@ -80,15 +84,26 @@ public List<BoxEvent> getEnterpriseEvents(String position, 
Date after, Date befo
             }
 
             EnterpriseEventsRequest request = new EnterpriseEventsRequest();
-            
request.position(position).after(after).before(before).types(types);
-            EventLog eventLog = EventLog.getEnterpriseEvents(boxConnection, 
request);
+            request.after(after).before(before).types(types);
 
-            List<BoxEvent> results = new ArrayList<>();
-            for (BoxEvent event : eventLog) {
-                results.add(event);
+            // The service returns the events in chunks (of at most 500 
events) with the position of the next
+            // chunk. Read on from that position until a chunk is empty, which 
is the end of the events within
+            // bounds. An event that the service returns in two chunks is kept 
once.
+            Set<BoxEvent> results = new LinkedHashSet<>();
+            String streamPosition = position;
+            while (true) {
+                EventLog eventLog = 
EventLog.getEnterpriseEvents(boxConnection, request.position(streamPosition));
+                for (BoxEvent event : eventLog) {
+                    results.add(event);
+                }
+                String nextStreamPosition = eventLog.getNextStreamPosition();
+                if (eventLog.getSize() == 0 || nextStreamPosition == null || 
nextStreamPosition.equals(streamPosition)) {

Review Comment:
   Leaving it as it is: harmless, the empty-chunk check ends the loop.
   
   _Claude Code on behalf of @davsclaus._



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