coreon-core 0.1.0

Core abstractions for camel-rs: Exchange, Processor, Endpoint, Component, CamelContext.
Documentation
//! Route — a consumer Endpoint wired to a Processor pipeline.

use crate::{endpoint::Endpoint, processor::Processor};
use std::sync::Arc;

pub type RouteId = String;

/// A Route binds an input Endpoint to a Processor pipeline. The Consumer is
/// lazily created by `CamelContext::start()` so that a route can be described
/// declaratively before the context is running.
#[derive(Clone)]
pub struct Route {
    pub id: RouteId,
    pub from: Arc<dyn Endpoint>,
    pub pipeline: Arc<dyn Processor>,
}

impl std::fmt::Debug for Route {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("Route")
            .field("id", &self.id)
            .field("from", &self.from.uri())
            .finish()
    }
}