[jira] [Updated] (CAMEL-18683) Priorize RouteTemplate initialization
[ https://issues.apache.org/jira/browse/CAMEL-18683?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Claus Ibsen updated CAMEL-18683: Fix Version/s: 3.21.0 4.0 > Priorize RouteTemplate initialization > - > > Key: CAMEL-18683 > URL: https://issues.apache.org/jira/browse/CAMEL-18683 > Project: Camel > Issue Type: Improvement > Components: camel-main >Reporter: Michael Rambichler >Priority: Minor > Fix For: 3.21.0, 4.0 > > > We often struggle the issue of the correct Route naming order dependency: > > *Improvement:* Priorize RouteBuilder with RouteTemplates > *Testcase:* > Name your RouteTemplate: ZTemplate > and another Routebuilder which will use the defined Template in ZTemplate. > The Routebuilder will fail because the ZTemplate Route was not yet added to > the routescollections. > *Suggestion:* Use a dedicated class e.g. RouteTemplateBuilder to prioritize > Routebuilder with templates > See: RoutesConfigure.java > private void addDiscoveredRoutes(CamelContext camelContext, > List routes) throws Exception { > // sort routes according to ordered > routes.sort(OrderedComparator.get()); > // first add the routes configurations as they are globally for all routes > for (RoutesBuilder builder : routes) { > if (builder instanceof RouteConfigurationsBuilder) { > RouteConfigurationsBuilder rcb = (RouteConfigurationsBuilder) > builder; > LOG.debug("Adding routes configurations into CamelContext from > RouteConfigurationsBuilder: {}", rcb); > camelContext.addRoutesConfigurations(rcb); > } > } > {color:#ff} // first add the all route templates as they are globally for > all routes > for (RoutesBuilder builder : routes) { > if (builder instanceof RouteTemplateBuilder) { > LOG.debug("Adding route tempaltes into CamelContext from RoutesBuilder: > {}", builder); > camelContext.addRoutes(builder); > } > }{color} > // then add the routes > for (RoutesBuilder builder : routes) { > LOG.debug("Adding routes into CamelContext from RoutesBuilder: {}", > builder); > camelContext.addRoutes(builder); > } > } > } -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Updated] (CAMEL-18683) Priorize RouteTemplate initialization
[ https://issues.apache.org/jira/browse/CAMEL-18683?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Michael Rambichler updated CAMEL-18683: --- Component/s: (was: came-core) camel-main > Priorize RouteTemplate initialization > - > > Key: CAMEL-18683 > URL: https://issues.apache.org/jira/browse/CAMEL-18683 > Project: Camel > Issue Type: Improvement > Components: camel-main >Reporter: Michael Rambichler >Priority: Minor > > We often struggle the issue of the correct Route naming order dependency: > > *Improvement:* Priorize RouteBuilder with RouteTemplates > *Testcase:* > Name your RouteTemplate: ZTemplate > and another Routebuilder which will use the defined Template in ZTemplate. > The Routebuilder will fail because the ZTemplate Route was not yet added to > the routescollections. > *Suggestion:* Use a dedicated class e.g. RouteTemplateBuilder to prioritize > Routebuilder with templates > See: RoutesConfigure.java > private void addDiscoveredRoutes(CamelContext camelContext, > List routes) throws Exception { > // sort routes according to ordered > routes.sort(OrderedComparator.get()); > // first add the routes configurations as they are globally for all routes > for (RoutesBuilder builder : routes) { > if (builder instanceof RouteConfigurationsBuilder) { > RouteConfigurationsBuilder rcb = (RouteConfigurationsBuilder) > builder; > LOG.debug("Adding routes configurations into CamelContext from > RouteConfigurationsBuilder: {}", rcb); > camelContext.addRoutesConfigurations(rcb); > } > } > {color:#ff} // first add the all route templates as they are globally for > all routes > for (RoutesBuilder builder : routes) { > if (builder instanceof RouteTemplateBuilder) { > LOG.debug("Adding route tempaltes into CamelContext from RoutesBuilder: > {}", builder); > camelContext.addRoutes(builder); > } > }{color} > // then add the routes > for (RoutesBuilder builder : routes) { > LOG.debug("Adding routes into CamelContext from RoutesBuilder: {}", > builder); > camelContext.addRoutes(builder); > } > } > } -- This message was sent by Atlassian Jira (v8.20.10#820010)