saluki_core/components/forwarders/
mod.rs

1//! Forwarder component basics.
2
3use async_trait::async_trait;
4use saluki_error::GenericError;
5
6mod builder;
7pub use self::builder::ForwarderBuilder;
8
9mod context;
10pub use self::context::ForwarderContext;
11
12/// A forwarder.
13///
14/// Forwarders are the final step in a topology, where events are sent to an external system, or exposed for
15/// collection. Examples of typical forwarders include databases, HTTP services, log files, and object storage.
16#[async_trait]
17pub trait Forwarder {
18    /// Runs the forwarder.
19    ///
20    /// The forwarder context provides access primarily to the payload stream, used to receive payloads sent to the
21    /// forwarder, as well as other information such as the component context.
22    ///
23    /// Forwarders are expected to run indefinitely until their payload stream is terminated, or an error occurs.
24    ///
25    /// # Errors
26    ///
27    /// If an unrecoverable error occurs while running, an error is returned.
28    async fn run(self: Box<Self>, context: ForwarderContext) -> Result<(), GenericError>;
29}