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


##########
core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultSupervisingRouteController.java:
##########
@@ -409,6 +409,56 @@ public void resumeRoute(String routeId) throws Exception {
         }
     }
 
+    @Override
+    public void startRouteGroup(String routeGroup) throws Exception {
+        lock.lock();
+        try {
+            List<RouteHolder> group = routesOfGroup(routeGroup);
+            for (RouteHolder route : group) {
+                // as startRoute: the controller takes care that the route is 
started, and the manual start cancels a
+                // restart task (and clears an exhausted state)
+                route.get().setRouteController(this);
+                routeManager.release(route);
+            }
+            try {
+                super.startRouteGroup(routeGroup);
+            } catch (Exception e) {
+                // as startRoute: the routes of the group that did not start 
are moved to the controller supervision,
+                // so they get (eventually) restarted
+                for (RouteHolder route : group) {
+                    if (route.getStatus().isStopped()) {
+                        LOG.debug("Route {} of route group {} failed to start 
and is moved to the controller supervision",
+                                route.getId(), routeGroup);
+                        
EventHelper.notifyRouteRestartingFailure(getCamelContext(), route.get(), 0, e, 
false);
+                        routeManager.start(route);
+                    }
+                }
+                throw e;
+            }
+        } finally {
+            lock.unlock();
+        }
+    }
+
+    @Override
+    public void stopRouteGroup(String routeGroup) throws Exception {
+        lock.lock();
+        try {
+            for (RouteHolder route : routesOfGroup(routeGroup)) {
+                // as stopRoute: a route stopped manually is no longer started 
by its restart task
+                routeManager.release(route);
+                route.get().setRouteController(null);
+            }
+            super.stopRouteGroup(routeGroup);
+        } finally {
+            lock.unlock();
+        }
+    }
+
+    private List<RouteHolder> routesOfGroup(String routeGroup) {

Review Comment:
   Confirmed at the head: `startRoute(id)`/`stopRoute(id)` (lines 306 and 319) 
do not check supervision either, and routes left out by 
`excludeRoutes`/`includeRoutes` are added to `routes` in `onInit`. So 
`routesOfGroup` treats routes the same way the per-route methods do. Resolving.
   
   _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