Skip to main content

coreon_core/
component.rs

1//! Component — factory that turns URIs into Endpoints.
2
3use crate::{endpoint::Endpoint, error::Result, uri::CamelUri};
4use async_trait::async_trait;
5use std::sync::Arc;
6
7#[async_trait]
8pub trait Component: Send + Sync {
9    /// The scheme this component handles (e.g. "direct", "log").
10    fn scheme(&self) -> &str;
11
12    /// Build (or look up) an endpoint from a parsed URI.
13    async fn create_endpoint(&self, uri: &CamelUri) -> Result<Arc<dyn Endpoint>>;
14}