Skip to main content

Endpoint

Trait Endpoint 

Source
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 method
    fn body_contract(&self) -> Option<BodyType> { ... }
}
Expand description

An Endpoint represents a source or destination in a route URI.

Required Methods§

Source

fn uri(&self) -> &str

The URI that identifies this endpoint.

Source

fn create_consumer(&self) -> Result<Box<dyn Consumer>, CamelError>

Create a consumer that reads from this endpoint.

Source

fn create_producer( &self, ctx: &ProducerContext, ) -> Result<BoxProcessor, CamelError>

Create a producer that writes to this endpoint.

Provided Methods§

Source

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).

Implementors§