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


##########
components/camel-quartz/src/main/java/org/apache/camel/routepolicy/quartz/ScheduledRoutePolicy.java:
##########
@@ -82,13 +88,16 @@ public void onJobExecute(Action action, Route route) throws 
Exception {
         } else if (action == Action.SUSPEND) {
             if (routeStatus == ServiceStatus.Started) {
                 suspendOrStopConsumer(route.getConsumer());
+                if (ServiceHelper.isStopped(route.getConsumer())) {
+                    consumersStoppedBySuspend.add(route.getId());
+                }

Review Comment:
   `suspendOrStopConsumer` stops a non-`Suspendable` consumer even when it is 
already stopped, so this also records a consumer that the shutdown strategy or 
another policy had stopped before the trigger fired. Checking before the 
suspend keeps the record to what this policy did:
   
   ```suggestion
                   Consumer consumer = route.getConsumer();
                   boolean alreadyStopped = ServiceHelper.isStopped(consumer);
                   suspendOrStopConsumer(consumer);
                   if (!alreadyStopped && ServiceHelper.isStopped(consumer)) {
                       consumersStoppedBySuspend.add(route.getId());
                   }
   ```



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