pub struct DefaultRouteController { /* private fields */ }Expand description
Default implementation of RouteController.
Manages route lifecycle with support for:
- Starting/stopping individual routes
- Suspending and resuming routes
- Auto-startup with startup ordering
- Graceful shutdown
Implementations§
Source§impl DefaultRouteController
impl DefaultRouteController
Sourcepub fn new(registry: Arc<Mutex<Registry>>) -> Self
pub fn new(registry: Arc<Mutex<Registry>>) -> Self
Create a new DefaultRouteController with the given registry.
Sourcepub fn set_self_ref(&mut self, self_ref: Arc<Mutex<dyn RouteController>>)
pub fn set_self_ref(&mut self, self_ref: Arc<Mutex<dyn RouteController>>)
Set the self-reference for creating ProducerContext.
This must be called after wrapping the controller in Arc<Mutex<>>.
Sourcepub fn set_error_handler(&mut self, config: ErrorHandlerConfig)
pub fn set_error_handler(&mut self, config: ErrorHandlerConfig)
Set a global error handler applied to all routes without a per-route handler.
Sourcepub fn add_route(
&mut self,
definition: RouteDefinition,
) -> Result<(), CamelError>
pub fn add_route( &mut self, definition: RouteDefinition, ) -> Result<(), CamelError>
Add a route definition to the controller.
Steps are resolved immediately using the registry.
§Errors
Returns an error if:
- A route with the same ID already exists
- Step resolution fails
Sourcepub fn route_count(&self) -> usize
pub fn route_count(&self) -> usize
Returns the number of routes in the controller.
Sourcepub fn swap_pipeline(
&self,
route_id: &str,
new_pipeline: BoxProcessor,
) -> Result<(), CamelError>
pub fn swap_pipeline( &self, route_id: &str, new_pipeline: BoxProcessor, ) -> Result<(), CamelError>
Atomically swap the pipeline of a route.
In-flight requests finish with the old pipeline (kept alive by Arc). New requests immediately use the new pipeline.
Sourcepub fn route_from_uri(&self, route_id: &str) -> Option<&str>
pub fn route_from_uri(&self, route_id: &str) -> Option<&str>
Returns the from_uri of a route, if it exists.
Sourcepub fn get_pipeline(&self, route_id: &str) -> Option<BoxProcessor>
pub fn get_pipeline(&self, route_id: &str) -> Option<BoxProcessor>
Get a clone of the current pipeline for a route.
This is useful for testing and introspection.
Returns None if the route doesn’t exist.