Skip to main content

camel_component_api/
component.rs

1use camel_api::CamelError;
2
3use crate::component_context::ComponentContext;
4use crate::endpoint::Endpoint;
5
6/// A Component is a factory for Endpoints.
7///
8/// Each component handles a specific URI scheme (e.g. "timer", "log", "direct").
9pub trait Component: Send + Sync {
10    /// The URI scheme this component handles (e.g., "timer", "log").
11    fn scheme(&self) -> &str;
12
13    /// Create an endpoint from a URI string.
14    fn create_endpoint(
15        &self,
16        uri: &str,
17        ctx: &dyn ComponentContext,
18    ) -> Result<Box<dyn Endpoint>, CamelError>;
19}