pub trait Component: Send + Sync {
// Required methods
fn scheme(&self) -> &str;
fn create_endpoint(
&self,
uri: &str,
ctx: &dyn ComponentContext,
) -> Result<Box<dyn Endpoint>, CamelError>;
// Provided methods
fn metadata(&self) -> ComponentMetadata { ... }
fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
A Component is a factory for Endpoints.
Each component handles a specific URI scheme (e.g. “timer”, “log”, “direct”).
Required Methods§
Sourcefn create_endpoint(
&self,
uri: &str,
ctx: &dyn ComponentContext,
) -> Result<Box<dyn Endpoint>, CamelError>
fn create_endpoint( &self, uri: &str, ctx: &dyn ComponentContext, ) -> Result<Box<dyn Endpoint>, CamelError>
Create an endpoint from a URI string.
Provided Methods§
Sourcefn metadata(&self) -> ComponentMetadata
fn metadata(&self) -> ComponentMetadata
Declare this component’s metadata (URI options, capabilities, version).
Called once at registration time to harvest metadata into the catalog. Override to provide rich metadata; the default returns a minimal entry with just the scheme name.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".