pub trait Endpoint: Send + Sync {
// Required methods
fn uri(&self) -> &str;
fn create_consumer(&self) -> Result<Box<dyn Consumer>, CamelError>;
fn create_producer(
&self,
ctx: &ProducerContext,
) -> Result<BoxProcessor, CamelError>;
// Provided methods
fn body_contract(&self) -> Option<BodyType> { ... }
fn polling_consumer(&self) -> Option<Box<dyn PollingConsumer>> { ... }
}Expand description
An Endpoint represents a source or destination in a route URI.
Required Methods§
Sourcefn create_consumer(&self) -> Result<Box<dyn Consumer>, CamelError>
fn create_consumer(&self) -> Result<Box<dyn Consumer>, CamelError>
Create a consumer that reads from this endpoint.
Sourcefn create_producer(
&self,
ctx: &ProducerContext,
) -> Result<BoxProcessor, CamelError>
fn create_producer( &self, ctx: &ProducerContext, ) -> Result<BoxProcessor, CamelError>
Create a producer that writes to this endpoint.
Provided Methods§
Sourcefn body_contract(&self) -> Option<BodyType>
fn body_contract(&self) -> Option<BodyType>
Optional body type contract for the producer.
When Some(t), the pipeline will coerce the body to t before calling
the producer. Default: None (accept any body variant, zero overhead).
Sourcefn polling_consumer(&self) -> Option<Box<dyn PollingConsumer>>
fn polling_consumer(&self) -> Option<Box<dyn PollingConsumer>>
Return a polling consumer for this endpoint, if supported.
Polling consumers use a pull model — callers invoke
PollingConsumer::receive to retrieve the next message.
Endpoints that only support push-based consumption should leave
this default (returns None).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".