Skip to main content

coreon_core/
route.rs

1//! Route — a consumer Endpoint wired to a Processor pipeline.
2
3use crate::{endpoint::Endpoint, processor::Processor};
4use std::sync::Arc;
5
6pub type RouteId = String;
7
8/// A Route binds an input Endpoint to a Processor pipeline. The Consumer is
9/// lazily created by `CamelContext::start()` so that a route can be described
10/// declaratively before the context is running.
11#[derive(Clone)]
12pub struct Route {
13    pub id: RouteId,
14    pub from: Arc<dyn Endpoint>,
15    pub pipeline: Arc<dyn Processor>,
16}
17
18impl std::fmt::Debug for Route {
19    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
20        f.debug_struct("Route")
21            .field("id", &self.id)
22            .field("from", &self.from.uri())
23            .finish()
24    }
25}