Yes, I think it's also present in Camel 3: https://www.javadoc.io/static/org.apache.camel/camel-core-model/3.20.7/org/apache/camel/model/Model.html
There you have: removeRouteConfiguration Didn't found as the removeRoute is on the CamelContext, but removeConfiguration only on the CamelModelContext. Not sure if this is the best way, but following worked: if(route.getConfigurationId()!=null){ ModelCamelContext modelContext = (ModelCamelContext) context; RouteConfigurationDefinition routeConfigurationDefinition = modelContext.getRouteConfigurationDefinition(route.getConfigurationId()); if(routeConfigurationDefinition!=null){ modelContext.removeRouteConfiguration(routeConfigurationDefinition); } } Raymond On Sat, Oct 7, 2023 at 9:59 AM Claus Ibsen <claus.ib...@gmail.com> wrote: > Hi > > You are using Camel 3 but there is API on Camel 4 (maybe also in 3 but I > dont bother to check). > Where you can remove via the model (def class). So you need to remove that > way. > > > > On Tue, Oct 3, 2023 at 9:34 PM ski n <raymondmees...@gmail.com> wrote: > > > I have a route and a routeConfiguration. I want to remove both from the > > CamelContext. > > > > I tried it like this: > > > > String routeId = route.getId(); > > String routeConfigurationId = route.getConfigurationId(); > > > > //remove route > > routeController.stopRoute(routeId, 30, TimeUnit.SECONDS); > > context.removeRoute(routeId); > > > > //remove routeConfiguration > routeController.stopRoute(routeConfigurationId, > > 30, TimeUnit.SECONDS); > > context.removeRoute(routeConfigurationId); > > > > The route is removed and there are no errors. However, when I load the > > route later again it says: > > > > "Route configuration already exists with id: 1234" > > > > The remove probably didn't work. There are no other routes using this > > configuration. > > > > How to properly remove the routeConfiguration? > > > > Note: I use Camel 3.20.7 > > Note 2: When I do > > > > context.getRoutesSize(); > > > > Before removal I get 1 and after removal I get 0. > > > > Note 3: On the CamelContext (context) there is: > > > > context.addRoutesConfigurations(); > > > > But there are no methods like getRoutesConfigurations or > > removeRouteConfiguration(routeId); > > > > Kind regards, > > > > Raymond > > > > > -- > Claus Ibsen > ----------------- > @davsclaus > Camel in Action 2: https://www.manning.com/ibsen2 >