You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Jan Bednar (Jira)" <ji...@apache.org> on 2020/09/22 19:23:00 UTC

[jira] [Resolved] (CAMEL-15568) Dynamic route updates causes few requests to fails

     [ https://issues.apache.org/jira/browse/CAMEL-15568?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jan Bednar resolved CAMEL-15568.
--------------------------------
    Resolution: Not A Problem

Hot reload of routes is not supported usage of this API. There are projects in Camel ecosystem much more suitable for this, like camel-quarkus or camel-k. 
You can also deploy your app in some application server, which support hot deploy (like Karaf, Fuse).

If you need more help with this, please ask on mailing list, gitter, or StackOverflow. This is not a bug.
https://camel.apache.org/manual/latest/support.html

> Dynamic route updates causes few requests to fails 
> ---------------------------------------------------
>
>                 Key: CAMEL-15568
>                 URL: https://issues.apache.org/jira/browse/CAMEL-15568
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core-engine
>    Affects Versions: 3.2.0
>            Reporter: Minal Bhalodi
>            Priority: Minor
>
> We are using Apache Camel 3.2.0. We update camel routes at runtime using below code. 
> // update routes in camel contexts. Definitions are in XML files
> ModelCamelContext mcc = camelContext.adapt(ModelCamelContext.class);
>  mcc.addRouteDefinitions({{workflowDefinitionsList}}); {{// workflowDefinitionsList is the list of XML routes}}
>  
> *Problem Statement*: Dynamic routes updates causes few requests to fail at runtime. When these routes are being updated, we also call getRoute to serve live traffic.
> Since addRouteDefinitions first delete routes given in {{workflowDefinitionsList}} from camel context and then add those routes back to camelcontext, These routes won't be available for few mili second and that causes request to fails.
> Route route = exchange.getContext().getRoute(workflowRouteId);  // get route
> Since there can be only one CamelContext per Application, I am not sure how can I resolve this issue. Is there any other method available where we can PATCH routes changes at runtime. Dynamic route updates shouldn't cause few requests to fails.
>  
>  
> {{Here is camel 3 code for addRouteDefinitions method where routes are being removed and added:}}
> {code:java}
> public synchronized void addRouteDefinitions(Collection<RouteDefinition> routeDefinitions) throws Exception {
>     if (routeDefinitions != null && !routeDefinitions.isEmpty()) {
>         List<RouteDefinition> list = new ArrayList();
>         routeDefinitions.forEach((r) -> {
>             if (this.routeFilter == null || (Boolean)this.routeFilter.apply(r)) {
>                 list.add(r);
>             }
>         });
>         this.removeRouteDefinitions(list);
>         this.routeDefinitions.addAll(list);
>         if (this.shouldStartRoutes()) {
>             ((ModelCamelContext)this.getCamelContext().adapt(ModelCamelContext.class)).startRouteDefinitions(list);
>         }
>     }
> }
> {code}
>  
>  
> We are not able to updates routes in camelcontext frequently because of this issue. Everytime we update routes in camelcontext that causes us some FCI since we have high traffic in our application. 
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)