camel_component/endpoint.rs
1use camel_api::{BoxProcessor, CamelError};
2
3use crate::ProducerContext;
4use crate::consumer::Consumer;
5
6/// An Endpoint represents a source or destination in a route URI.
7pub trait Endpoint: Send + Sync {
8 /// The URI that identifies this endpoint.
9 fn uri(&self) -> &str;
10
11 /// Create a consumer that reads from this endpoint.
12 fn create_consumer(&self) -> Result<Box<dyn Consumer>, CamelError>;
13
14 /// Create a producer that writes to this endpoint.
15 fn create_producer(&self, ctx: &ProducerContext) -> Result<BoxProcessor, CamelError>;
16}