This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch CAMEL-25142-design-analysis in repository https://gitbox.apache.org/repos/asf/camel.git
commit cd6d0758f9b6f41b0b6d81c008ea65eabd97927b Author: Claus Ibsen <[email protected]> AuthorDate: Thu Dec 3 22:11:16 2026 +0100 CAMEL-25142: design - verified current state, and refresh the affected routes in 4.x Update the design of late binding of cross-cutting features with the analysis of December 2026: - the current state, checked with probe tests on main (order of the merged outputs, what an intercept reaches, what survives a restart) - the bugs found, filed as CAMEL-28096 to CAMEL-28101 - the decisions: a route restart is acceptable in 4.x, intercept is for the main route path, a route configuration change bumps the route revision, and only the routes loader triggers a refresh - the 4.x proposal: keep the route as written, and merge again and restart only the routes affected by a route configuration change - what late binding in Camel 5 needs Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- design/cross-cutting-binding.adoc | 332 ++++++++++++++++++++++++++------------ 1 file changed, 230 insertions(+), 102 deletions(-) diff --git a/design/cross-cutting-binding.adoc b/design/cross-cutting-binding.adoc index 83dd3f4fccd4..5ca3c4a819e2 100644 --- a/design/cross-cutting-binding.adoc +++ b/design/cross-cutting-binding.adoc @@ -5,13 +5,20 @@ authors: reviewers: [] approvers: [] creation-date: 2026-09-29 -last-updated: 2026-09-29 +last-updated: 2026-12-03 status: proposed see-also: - "CAMEL-25142" - "CAMEL-25140" - "CAMEL-25141" - "CAMEL-18923" + - "CAMEL-24980" + - "CAMEL-28096" + - "CAMEL-28097" + - "CAMEL-28098" + - "CAMEL-28099" + - "CAMEL-28100" + - "CAMEL-28101" replaces: [] superseded-by: [] --- @@ -20,9 +27,18 @@ superseded-by: [] The cross-cutting features of Camel routes (`onException` and the error handler, `intercept`, `interceptFrom`, `interceptSendToEndpoint` and `onCompletion`) and the route configurations that hold them are bound to the routes -when the routes are created. After that the binding is fixed. This proposal describes how they are bound today, and a -model where they are bound late: the routes resolve what applies to them from a registry in the `CamelContext`, so -changes to routes and route configurations while Camel runs keep working as expected. +when the routes are created. After that the binding is fixed, so changing a route configuration while Camel runs does +not reach the routes that use it. + +This document describes how they are bound today (checked with probe tests on main in December 2026), and proposes +two steps: + +* *Camel 4.x:* when a route configuration is added, updated or removed through the routes loader, Camel finds the + routes that use it, merges the route configurations again into the route as written, and restarts only those routes. + This covers every cross-cutting feature, including the type of the error handler, and costs nothing on the hot path. +* *Camel 5:* real late binding, where the routes resolve the cross-cutting features from a registry in the + `CamelContext` while they run, without a restart. The analysis showed that this touches the error handler, the + `Channel` and public APIs, so it is not a goal for 4.x. == Motivation @@ -34,71 +50,114 @@ The static binding does not handle this well: - Updating or removing a route configuration at runtime does not update the routes that use it (see also CAMEL-18923, where this was explained as "not supported, as they can be global and affect running routes"). -- Dev mode reload works because by default it removes all the routes and loads all the files again. -- Some features are lost when the routes are created again, such as on a `CamelContext` restart. -- `interceptSendToEndpoint` bound the endpoint to the processors of one route, so removing that route broke the other - routes (CAMEL-25140). - -Historically these features were implemented as internal processors woven into each route, with a lot of logic to make -them fast. That gives good performance, but makes them complex, and hard to change when routes and configurations are -dynamic. +- Dev mode reload works because by default it removes all the routes and loads all the files again. Route + configurations removed from a file are never removed (CAMEL-28101). +- `intercept` is lost when a route is created again from its definition, such as on a `CamelContext` restart + (CAMEL-28100). +- Several paths do not merge the route configurations correctly (CAMEL-28096, CAMEL-28097, CAMEL-28099). == Goals -- The cross-cutting features keep working when routes are added, removed, reloaded or restarted, and when route - configurations are added, updated or removed at runtime. +- Camel 4.x: adding, updating or removing a route configuration through the routes loader updates the routes that use + it, and only those. - The per-message behaviour stays as today (which exception policy matches, `onWhen` predicates, endpoint patterns, and the order of precedence). -- No noticeable overhead on the hot path. -- Simpler code than today, where possible. +- No overhead on the hot path. +- Fix the bugs found in the current binding, each on its own. == Non-goals - Changing the scope of the interceptors (such as limiting `interceptSendToEndpoint` to the routes it is defined for); see CAMEL-25141. - Changing the DSLs or the model classes that end users use. +- Camel 4.x: changing the cross-cutting features of a route without restarting the route. +- Camel 4.x: refreshing the routes of Spring or Blueprint XML (`<camelContext>`). They share the merge code, but are not + refreshed. == Current design -This describes the state of Camel 4.23 (main in September 2026). +This describes the state of main (4.25.0-SNAPSHOT) in December 2026. The statements marked _(probe)_ were checked with +tests; the others come from reading the code. === Model time: merging into the routes -`RoutesDefinition.prepareRoute` merges the definitions of the `RouteBuilder` and the matching route configurations -into each route, and `RouteDefinitionHelper.prepareRoute` adds them to the outputs of the route: +The cross-cutting definitions of the `RouteBuilder` and of the matching route configurations are merged into each +route by `RoutesDefinition.prepareRoute`, which calls `RouteDefinitionHelper.prepareRoute`: - The route configurations are selected by the `routeConfigurationId` of the route (a list of ids or patterns), or the global ones (without an id) when the route has none (`RouteDefinitionHelper.routesByIdOrPattern`). - For `onException`, the order is: the route's own, then the `RouteBuilder`'s, then the route configurations'. For the error handler: the route's own, then the `RouteBuilder`'s, then the last matching route configuration, then the default of the `CamelContext`. A route with an `onCompletion` of its own ignores the global ones. -- The definition objects are shared by all the routes they apply to (the lists are new, the definitions are not). -- A route is prepared only once (`RouteDefinition.isPrepared`). Changes to the route configurations after that are not - merged into it. `DefaultModel.addRouteConfiguration` and `removeRouteConfiguration` only change the list of - configurations. +- The definition objects are shared by all the routes they apply to (the lists are new, the definitions are not), and + the merge changes them: `setRouteScoped(false)`, `initParent`, and for `onCompletion` the back-pointer to its route + configuration (CAMEL-25420). +- After the merge, the outputs of a route are, in this order: `onException`, `interceptSendToEndpoint`, + `interceptFrom`, `intercept`, `onCompletion`, then the steps of the route _(probe)_. +- The route records the ids of the route configurations it used (`Route.getConfigurationId()`, also on JMX). +- The route as written is not kept: the merge changes the outputs in place, and transacted and saga steps are rewired. + Only the checksum of the route as written is kept (CAMEL-25771), which is taken before the merge, so a change of a + route configuration does not change the revision of a route. +- A route is prepared only once (`RouteDefinition.isPrepared`). Preparing it again is not idempotent: the definitions + of the first merge are then seen as the route's own. + +The merge runs when a `RouteBuilder` is configured, so the route configurations must be in the `CamelContext` before +that. The paths that prepare a route: + +[cols="2,3"] +|=== +| Path | Route configurations merged + +| `RouteBuilder`, and the routes loader (Java, XML, YAML) +| Yes. + +| A route from a route template or a Kamelet (`DefaultModel.addRouteFromTemplate`) +| Yes. A Kamelet route uses the `routeConfigurationId` of its parent. + +| Spring and Blueprint XML (`AbstractCamelContextFactoryBean.prepareRoutes`) +| Yes, by a second copy of the merge code, with small differences. + +| `ModelCamelContext.addRouteDefinition` of a route that is not prepared, also JMX `updateRouteFromXml` +| No (CAMEL-28097). + +| `AdviceWith` +| Twice: the advised route is prepared again (CAMEL-28099). +|=== + +The list of route configurations in `DefaultModel` has a bug of its own: looking up a configuration by id gives every +global configuration a generated id, after which it no longer applies to routes without a `routeConfigurationId`. So +a global configuration cannot be replaced or removed, and reloading any route configuration takes the global ones away +from the routes added after the reload _(probe)_ (CAMEL-28096). === Reify time: processors per route -- *onException / error handler:* `OnExceptionReifier` creates the `onException` processors of the route - (`Route.setOnException`). An error handler is created for each `Channel` (each EIP node), and each gets its own map - of exception policies built from the route's `onException` definitions (`ErrorHandlerReifier.configure`). -- *intercept:* `InterceptReifier` adds an `InterceptStrategy` to the route, and removes its definition from the route - outputs. Each `Channel` applies the intercept strategies when the `Channel` is built (`DefaultChannel.initChannel`), - so only the `Channel`s built after the intercept is reified are intercepted (from reading the code, not verified - with a test). -- *interceptFrom:* `InterceptFromReifier` creates a filter step at the start of the route. -- *interceptSendToEndpoint:* until CAMEL-25140, the reifier registered an endpoint callback that wrapped the endpoint - with the processors of the route, and removed its definition from the route outputs. With CAMEL-25140 the endpoint - is wrapped once, and each route registers its interceptor on it while the route runs. -- *onCompletion:* `OnCompletionReifier` stores the processors on the route (`Route.setOnCompletion`) and creates an - `OnCompletionProcessor` step, which adds a synchronization to the unit of work of each exchange. - -=== Runtime - -- Exception policies are only looked up when an exchange fails (`DefaultExceptionPolicyStrategy`), from the policies - of the error handler of the failing `Channel`. -- Intercept strategies cost a wrap per `Channel`, decided when the route is built. -- `onCompletion` adds a synchronization per exchange. +*onException and the error handler.* An error handler is created for each `Channel` (each EIP node), plus some for +EIPs that send to several destinations (Multicast, Recipient List, Routing Slip, Dynamic Router, Wire Tap). Each error +handler gets its own copy of the exception policies, built from the `onException` definitions of the route +(`ErrorHandlerReifier.configure`). The `onException` processors exist once per route; on a failure they are found from +the route of the exchange, not from the error handler. The policies are looked up when an exchange fails, but which +policies exist is also used when the route is built: whether each step keeps a copy of the IN message for redelivery, +which redelivery task the error handler uses, and where JMX counts the exchanges. + +*intercept.* `InterceptReifier` adds an `InterceptStrategy` to the route, and removes its definition from the route +outputs. Each `Channel` takes the intercept strategies that exist when it is built, so the intercept reaches only the +steps built after it (see the order of the outputs above). So the steps of `onException`, `interceptFrom` and +`interceptSendToEndpoint` are not intercepted, while the `onCompletion` step and its steps are _(probe)_. From reading +the code, several intercepts run in an order that depends on where they come from: the intercepts of a route +configuration run in reverse declaration order, and before the ones of the `RouteBuilder`. + +*interceptFrom.* `InterceptFromReifier` creates a filter step at the start of the route. Its endpoint pattern is +matched once, when the route is prepared. + +*interceptSendToEndpoint.* Since CAMEL-25140 and CAMEL-26541 the endpoint is wrapped once, and each route registers its +interceptor on it while the route runs. This survives route restarts and removal, and reaches endpoints created +later. Not covered: a pattern added later does not reach the static `to` of routes that already exist +(`SendProcessor` keeps its destination), and patterns are never removed. + +*onCompletion.* `OnCompletionReifier` stores the processors on the route and creates an `OnCompletionProcessor` step, +which adds a synchronization when an exchange enters the route. The unit of work is created only once, in the first +route, and the duplicate check of CAMEL-25135 and CAMEL-25420 depends on the synchronization being added on route +entry. === Lifecycle @@ -106,106 +165,175 @@ into each route, and `RouteDefinitionHelper.prepareRoute` adds them to the outpu |=== | Change | What happens today -| Route configuration added or removed at runtime -| Only the list changes. Existing routes keep the merged definitions; only routes prepared later see the change. +| Route configuration added at runtime +| Only the list changes. Running routes do not get it; routes added later do _(probe)_. + +| Route configuration removed at runtime +| Only the list changes. Running routes keep it _(probe)_. A route added later with its id starts without an error and + without it _(probe)_. A global configuration is not removed at all (CAMEL-28096) _(probe)_. | Route configuration updated (same id) -| Only the list changes (the routes loader removes and adds it again). The routes keep the old definitions. +| The routes loader removes and adds it again. Running routes keep the old definitions _(probe)_. A new + `RouteDefinition` gets the new one; adding the same `RouteDefinition` object again keeps the old one, as it is + already prepared _(probe)_. | Dev mode reload (default `removeAllRoutes=true`) -| All the routes are removed, and all the files are loaded again, so the routes are prepared again with the new - configurations. +| All the routes are removed, and all the files are loaded again, so the routes get the changed configurations. A + configuration removed from a file, or in a deleted file, stays and is still merged (CAMEL-28101). | Dev mode reload with `removeAllRoutes=false` -| Only the routes of the changed files are prepared again. Routes in other files keep the old configurations, and - configurations removed from a file are never removed. +| Only the routes of the changed files are prepared again. Routes in other files keep the old configurations. | `CamelContext` stop and start -| The routes are created again from their prepared definitions. The definitions that removed themselves from the route - outputs are lost: `interceptSendToEndpoint` before CAMEL-25140 (verified with a test), and `intercept` (from reading - the code, not verified). +| The routes are created again from their prepared definitions. `intercept` is lost, also when it comes from a route + configuration (CAMEL-28100) _(probe)_. `onException`, `onCompletion`, `interceptFrom` and + `interceptSendToEndpoint` survive _(probe)_. + +| Route stopped and started (`RouteController`) +| Everything is kept, as the processors are reused _(probe)_. | Route removed -| Its processors are removed. Before CAMEL-25140, an `interceptSendToEndpoint` shared by other routes stopped working. +| Its processors are removed. Since CAMEL-25140, an `interceptSendToEndpoint` shared by other routes keeps working + _(probe)_. |=== -== Proposal +=== Tooling + +- The XML dump, the `route-structure` dev console and the route diagrams show the merged routes. +- The YAML dump takes the context-scoped definitions out of the routes again (CAMEL-25490, CAMEL-25494, CAMEL-25651), + by the identity of the definitions. After a route configuration is updated, the old definitions no longer belong to + any configuration and are dumped as top-level entries (CAMEL-28098). +- The route revision (CAMEL-25771) does not change when a route configuration changes. + +== Decisions + +Taken on 2026-12-03: + +. Restarting a route is an acceptable meaning of "the route configuration was updated" in Camel 4.x. Late binding + without a restart is left for Camel 5. +. `intercept` is meant for the main route path. The steps of `onCompletion` are no longer intercepted + (CAMEL-28100), like the steps of `onException`, `interceptFrom` and `interceptSendToEndpoint` today. A clear + definition of what an intercept covers is left for Camel 5. +. Any change of a route configuration that applies to a route bumps the revision of that route. +. Only the routes loader (`RoutesLoader.updateRoutes`, which the dev mode reload and tooling use) triggers the refresh + of the routes. Adding or removing a route configuration with the `Model` API does not restart routes. + +== Proposal for Camel 4.x: refresh the affected routes + +=== Keep the route as written -=== A registry of cross-cutting definitions +When a route is prepared, keep a deep copy of its outputs and error handler as written, before the merge +(`ProcessorDefinitionHelper.deepCopyDefinitions`, as route templates already do), and a reference to the cross-cutting +definitions of its `RouteBuilder`. Only routes of a `CamelContext` that has route configurations need the copy. -The `CamelContext` keeps the cross-cutting definitions in a registry, keyed by where they come from (a `RouteBuilder` -or a route configuration), instead of copying them into the routes when the routes are prepared. A route knows its -sources (its `RouteBuilder` and its `routeConfigurationId`), and resolves what applies to it from the registry, in the -same order of precedence as today. +The merge moves into one method of `RouteDefinitionHelper`, which `RoutesDefinition.prepareRoute` and +`AbstractCamelContextFactoryBean.prepareRoutes` both use. The copy also fixes `AdviceWith`, which can then prepare the +advised route from the route as written (CAMEL-28099). -The definitions of a route itself (a route-level `onException`) stay in the route, as they belong to it. +=== Find the affected routes -=== Resolve late, cache, and check a generation +A route is affected when the route configurations that match it now differ from the ones it was merged with: a +different set of ids (a new global configuration, a pattern that now matches, a removed configuration), or a +configuration with the same id that was replaced. The route already records the ids it used. -To keep the hot path fast, the routes do not look up the registry per message: +=== Refresh -- The registry has a generation counter, which is incremented when a definition is added, updated or removed. -- Each route (or `Channel`) caches what it resolved, together with the generation it resolved it at. -- On the hot path, the check is a volatile read and an int compare. When the generation has changed, the route - resolves again (lazily, on the next exchange, or eagerly when the change is made). -- The decision per message (which exception policy, `onWhen`, endpoint pattern) is the same as today. +At the end of `DefaultRoutesLoader.updateRoutes`, after the route configurations and the routes of the changed files +are updated, Camel refreshes the affected routes that were not part of the update, once each: it takes a new copy of +the route as written, merges the current route configurations into it, and replaces the running route (stop, remove, +create, start), as `AdviceWith` does. The routes loader also removes the route configurations of a resource that is +gone or no longer declares them (CAMEL-28101). -=== The processors of cross-cutting features +The route checksum then includes the route configurations that were merged into the route, so a change bumps the +revision. `RouteChecksumTest.testRouteConfigurationsLeftOut` changes accordingly. -The processors of a cross-cutting feature (such as the steps of an `onException` or an `intercept`) are created per -route and per definition, and are created again (and the old ones stopped) when the definition changes. They follow the -lifecycle of the route: started when the route starts, stopped when it stops or is removed (as CAMEL-25140 does for -`interceptSendToEndpoint` with a route service). +=== What it covers, and what it costs -=== Per feature +It covers every cross-cutting feature, including the type and settings of the error handler, as the processors are +created again. Nothing changes on the hot path. -- *Route configurations:* adding, updating or removing a route configuration updates the routes that use it, by - incrementing the generation (no need to reload the routes). This is the unit of change for low-code tooling. -- *onException / error handler:* the exception policies are resolved from the registry (route, `RouteBuilder`, route - configurations) by the route, instead of being copied into a map per `Channel`. This ties in with the refactoring of - `RedeliveryErrorHandler` (CAMEL-24980). The error handler itself (its type and redelivery settings) could be resolved - the same way. -- *intercept / interceptFrom:* the `Channel` asks whether an intercept applies (cached per generation), instead of - being wrapped when it is built. The definitions are not removed from the model. -- *interceptSendToEndpoint:* done in CAMEL-25140 (wrapped once, interceptors registered per route). -- *onCompletion:* the global `onCompletion`s are resolved from the registry when the unit of work is created. +The cost is that of a route reload today: the consumer of the route stops and starts (a short gap for HTTP, a rebalance +for Kafka), in-flight exchanges are drained with the shutdown timeout, the in-memory state of stateful EIPs and the JMX +statistics of the route are reset, and generated node ids change. It also keeps one extra copy of the definition of +each route. -=== Order of work +Route shapes that need care: routes from route templates and Kamelets (whose child routes inherit the +`routeConfigurationId`), rest-inlined routes (rewritten after the merge), advised routes, and transacted and saga +routes (solved by the copy). -. Route configurations: keep them in the registry and resolve them in the routes (the groundwork for the other steps). -. onException and the error handler. -. intercept and interceptFrom. -. onCompletion. +=== Small improvement on its own -Each step keeps the public DSLs and model classes as they are, and adds tests for restart, reload and adding/removing -routes and route configurations. +The error handlers of a route can share one immutable map of exception policies instead of a copy each. This reduces +memory and route start time, changes no behaviour, and prepares for late binding in Camel 5. + +== Camel 5: late binding + +The idea of the first version of this document stays: the `CamelContext` keeps the cross-cutting definitions in a +registry, by `RouteBuilder` and route configuration, and the routes resolve what applies to them. What the analysis of +December 2026 adds: + +- *onException:* each exchange must keep the policies it started a step with, so a redelivery in progress finishes + with the old policy and the old `onException` processor. That is a read per step per exchange, and the old + processors can only be stopped when no exchange uses them. The parts that are fixed when the route is built (the copy + of the IN message, the redelivery task, JMX) must become independent of it. CAMEL-24980 (refactoring of + `RedeliveryErrorHandler`) should go first. +- *The error handler itself* (its type and redelivery settings) cannot be bound late without a different error + handling design: in practice changing it means creating the route again. +- *intercept* cannot be an advice of `CamelInternalProcessor`, as it runs a sub-route asynchronously and must stay + under the error handler (a redelivery runs it again). It can be one internal `InterceptStrategy` per route that reads + a replaceable snapshot of the intercepts: one volatile read per step, and no SPI change. The snapshot is built on the + thread that makes the change, not on the hot path, so no generation counter per `Channel` is needed. +- *onCompletion* must be resolved when an exchange enters a route, not when the unit of work is created. +- *interceptSendToEndpoint* must also reach the static `to` of existing routes and drop removed patterns. +- *Tooling* (dumps, diagrams, the route revision) needs a resolved view, as nothing is merged into the routes any more. +- *API:* `Route.getInterceptStrategies()` (a mutable list) and `Route.setOnCompletion` (no way to remove) would be + replaced by a binding API. With it come a clear definition of what an intercept covers, and CAMEL-25141. + +== Order of work + +. The bugs, each on its own: CAMEL-28096, CAMEL-28097, CAMEL-28098, CAMEL-28099, CAMEL-28100, CAMEL-28101. +. One map of exception policies per route. +. Keep the route as written, with one merge method (also fixes CAMEL-28099). +. Refresh the affected routes from the routes loader, and bump the revision. +. Camel 5: late binding, after CAMEL-24980. + +Each step adds tests for restart, reload and adding, updating and removing route configurations, and pins today's +semantics first (which steps an intercept reaches, the order of several intercepts). == Compatibility -The goal is to do this without changes to the public APIs and the DSLs, in which case it can be done in Camel 4.x -(4.24). If a step needs changes to public APIs (such as `Route`, `Channel` or the SPIs of the error handler) or -changes behaviour users rely on, that step becomes a goal for Camel 5.0. +Changes that need an entry in the upgrade guide (4.25): + +- Routes added with `ModelCamelContext.addRouteDefinition` (and JMX `updateRouteFromXml`) get the matching route + configurations (CAMEL-28097). +- The steps of `onCompletion` are no longer intercepted (CAMEL-28100). +- Updating a route configuration through the routes loader restarts the routes that use it, and bumps their revision. Known behaviour to keep: - The order of precedence of the route, the `RouteBuilder` and the route configurations. - `onCompletion` of a route overriding the global ones. -- What the dumped routes (`dumpRoutes`, the dev consoles, the route diagrams in the TUI) show. Today they show the - merged definitions; they should show the resolved view. == Risks -- *Performance:* every EIP node goes through a `Channel`, so any check there must be very cheap. Measure it with the - routing benchmarks (on Linux, as `System.nanoTime` does not scale across threads on macOS). -- *Concurrency:* a change while exchanges are in flight. An exchange should finish with what it resolved when it - started (or at the step), and the old processors should be stopped when no exchange uses them. +- *Restarts:* a route configuration used by many routes restarts all of them, one at a time. Tooling should show + which routes a change restarts. +- *Concurrency:* the list of route configurations is a plain `ArrayList` today; the refresh must run under the lock of + the routes loader. - *Semantics:* the order of precedence and the rules for which `onException` matches are documented and tested, and - must stay the same. The existing tests of camel-core and camel-spring-xml are the safety net. -- *Tooling:* tools that read the merged model need the resolved view. + must stay the same. The existing tests of camel-core, camel-yaml-dsl, camel-xml-io-dsl, camel-kamelet and + camel-spring-xml are the safety net. == Related tickets - CAMEL-25142: this work. +- CAMEL-28096: a lookup by id makes global route configurations non-global. +- CAMEL-28097: `addRouteDefinition` and JMX `updateRouteFromXml` merge no route configurations. +- CAMEL-28098: the YAML dump after a route configuration is updated. +- CAMEL-28099: `AdviceWith` merges the route configurations twice. +- CAMEL-28100: `intercept` is lost when a route is created again; the steps of `onCompletion` are no longer + intercepted. +- CAMEL-28101: route configurations removed from a file, or in a deleted file, are never removed. - CAMEL-25140: `interceptSendToEndpoint` registered per route on an endpoint wrapped once. - CAMEL-25141: limit `interceptSendToEndpoint` to the routes it is defined for. - CAMEL-18923: updating a route configuration with the routes loader.
