saluki_core/components/destinations/
mod.rs

1//! Destination component basics.
2
3use async_trait::async_trait;
4use saluki_error::GenericError;
5
6mod builder;
7pub use self::builder::DestinationBuilder;
8
9mod context;
10pub use self::context::DestinationContext;
11
12/// A destination.
13///
14/// Destinations are the final step in a topology, where events are sent to an external system, or exposed for
15/// collection. Examples of typical destinations include databases, HTTP services, log files, and object storage.
16#[async_trait]
17pub trait Destination {
18    /// Runs the destination.
19    ///
20    /// The destination context provides access primarily to the event stream, used to receive events sent to the
21    /// destination, as well as other information such as the component context.
22    ///
23    /// Destinations are expected to run indefinitely until their event 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: DestinationContext) -> Result<(), GenericError>;
29}