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


##########
components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackConsumer.java:
##########
@@ -77,20 +82,55 @@ protected int poll() throws Exception {
         // Maximum limit is 1000. Slack recommends no more than 200 results at 
a time.
         // https://api.slack.com/methods/conversations.history
         // We set the limit to 1 the first call to set the timestamp of the 
last message of the history
+        ConversationsHistoryResponse response = conversationsHistory(null);
+
+        // okay we have some response from slack so lets mark the consumer as 
ready
+        forceConsumerAsReady();
+
+        List<Message> messages = response.getMessages();
+        if (timestamp != null && response.isHasMore()) {
+            // the most recent messages of the range come first, so the 
messages that did not fit into this response
+            // are older ones: read the following pages, or they are skipped 
when the timestamp moves past them
+            messages = messages != null ? new ArrayList<>(messages) : new 
ArrayList<>();
+            String cursor = nextCursor(response);
+            while (cursor != null) {

Review Comment:
   Optional: stop paging when the consumer is stopping/suspended, so a long 
paging run doesn't keep calling Slack during shutdown.
   ```suggestion
               while (cursor != null && isRunAllowed()) {
   ```



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