Skip to main content

Source

Trait Source 

Source
pub trait Source {
    // Required method
    fn run<'async_trait>(
        self: Box<Self>,
        context: SourceContext,
    ) -> Pin<Box<dyn Future<Output = Result<(), GenericError>> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Expand description

A source.

Sources are the initial entrypoint to a topology, where events are ingested from external systems, or sometimes generated. Examples of typical sources include StatsD, log files, and message queues.

Required Methods§

Source

fn run<'async_trait>( self: Box<Self>, context: SourceContext, ) -> Pin<Box<dyn Future<Output = Result<(), GenericError>> + Send + 'async_trait>>
where Self: 'async_trait,

Runs the source.

The source context provides access primarily to the forwarder, used to send events to the next components in the topology, as well as other information such as the component context.

Sources are expected to run indefinitely until their shutdown is triggered by the topology, or an error occurs.

§Errors

If an unrecoverable error occurs while running, an error is returned.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§