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


##########
components/camel-reactive-streams/src/main/java/org/apache/camel/component/reactive/streams/ReactiveStreamsConsumer.java:
##########
@@ -61,17 +75,45 @@ protected void doStart() throws Exception {
                     getEndpoint().getEndpointUri(), poolSize);
         }
 
-        this.service.attachCamelConsumer(endpoint.getStream(), this);
+        // the items left queued by a stop that timed out are routed now
+        scheduleQueuedItems();
+
+        this.subscriber = 
this.service.attachCamelConsumer(endpoint.getStream(), this);
+    }
+
+    @Override
+    protected void doSuspend() throws Exception {
+        // nothing to wait for: while the consumer is suspended, its 
subscriber requests no more items from the stream
+        // and the queued items are not routed (see routeQueuedItem); the 
exchanges being routed complete normally
+    }
+
+    @Override
+    protected void doResume() throws Exception {
+        if (executor == null) {
+            // suspended while it was not started (before its start or after a 
stop)
+            doStart();

Review Comment:
   💡 **Nit:** `doResume()` calls `doStart()` directly when `executor == null`, 
which bypasses the `BaseService.start()` state machine — the status never 
transitions through `STARTING`. This works today because nothing in this 
consumer's start path gates on `STARTING`, and 
`testResumeStartsAConsumerThatWasNotStarted` covers this code path. Consider 
adding a brief comment here noting the deliberate shortcut, to guard against 
future base-class changes that add behavior conditioned on the `STARTING` 
transition:
   ```suggestion
               // Call doStart() directly (not via BaseService.start()) to 
avoid re-entering
               // the full start() state machine from inside resume(). This is 
safe because
               // the executor is created idempotently and nothing gates on 
STARTING status.
               doStart();
   ```



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