Skip to main content

ComponentContext

Trait ComponentContext 

Source
pub trait ComponentContext: Send + Sync {
    // Required methods
    fn resolve_component(&self, scheme: &str) -> Option<Arc<dyn Component>>;
    fn resolve_language(&self, name: &str) -> Option<Arc<dyn Language>>;
    fn metrics(&self) -> Arc<dyn MetricsCollector>;
    fn platform_service(&self) -> Arc<dyn PlatformService>;
    fn register_route_health_check(
        &self,
        route_id: &str,
        check: Arc<dyn AsyncHealthCheck>,
    );
    fn unregister_route_health_check(&self, route_id: &str);

    // Provided methods
    fn health(&self) -> Arc<dyn HealthCheckRegistry> { ... }
    fn route_id(&self) -> Option<&str> { ... }
    fn register_current_route_health_check(
        &self,
        check: Arc<dyn AsyncHealthCheck>,
    ) { ... }
}
Expand description

Runtime context passed to components during endpoint creation.

Required Methods§

Source

fn resolve_component(&self, scheme: &str) -> Option<Arc<dyn Component>>

Resolve a component by scheme.

Source

fn resolve_language(&self, name: &str) -> Option<Arc<dyn Language>>

Resolve a language by name.

Source

fn metrics(&self) -> Arc<dyn MetricsCollector>

Access the active metrics collector.

Source

fn platform_service(&self) -> Arc<dyn PlatformService>

Access the active platform service.

Source

fn register_route_health_check( &self, route_id: &str, check: Arc<dyn AsyncHealthCheck>, )

Source

fn unregister_route_health_check(&self, route_id: &str)

Provided Methods§

Source

fn health(&self) -> Arc<dyn HealthCheckRegistry>

Access the active health-check registry.

Used by component code paths that need to pin a route Unhealthy (category (g) per ADR-0012). Default: NoOp — tests/examples inherit the no-op. Concrete runtimes (CamelContext) override to return the real registry.

Source

fn route_id(&self) -> Option<&str>

Source

fn register_current_route_health_check(&self, check: Arc<dyn AsyncHealthCheck>)

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§