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:
- The route doesn’t have an ID
- 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.
Trait Implementations§
Source§impl RouteController for DefaultRouteController
impl RouteController for DefaultRouteController
Source§fn start_route<'life0, 'life1, 'async_trait>(
&'life0 mut self,
route_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn start_route<'life0, 'life1, 'async_trait>(
&'life0 mut self,
route_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Start a specific route by its ID. Read more
Source§fn stop_route<'life0, 'life1, 'async_trait>(
&'life0 mut self,
route_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stop_route<'life0, 'life1, 'async_trait>(
&'life0 mut self,
route_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stop a specific route by its ID. Read more
Source§fn restart_route<'life0, 'life1, 'async_trait>(
&'life0 mut self,
route_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn restart_route<'life0, 'life1, 'async_trait>(
&'life0 mut self,
route_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Restart a specific route by its ID. Read more
Source§fn suspend_route<'life0, 'life1, 'async_trait>(
&'life0 mut self,
route_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn suspend_route<'life0, 'life1, 'async_trait>(
&'life0 mut self,
route_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Suspend a specific route by its ID. Read more
Source§fn resume_route<'life0, 'life1, 'async_trait>(
&'life0 mut self,
route_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn resume_route<'life0, 'life1, 'async_trait>(
&'life0 mut self,
route_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Resume a suspended route by its ID. Read more
Source§fn route_status(&self, route_id: &str) -> Option<RouteStatus>
fn route_status(&self, route_id: &str) -> Option<RouteStatus>
Get the current status of a route by its ID. Read more
Auto Trait Implementations§
impl Freeze for DefaultRouteController
impl !RefUnwindSafe for DefaultRouteController
impl Send for DefaultRouteController
impl Sync for DefaultRouteController
impl Unpin for DefaultRouteController
impl UnsafeUnpin for DefaultRouteController
impl !UnwindSafe for DefaultRouteController
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more