Skip to main content

Relay

Trait Relay 

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

A relay.

Relays are the initial entrypoint to a topology for accepting raw payloads. Unlike sources, which decode/parse incoming data into events, relays simply accept raw bytes from the network and output them as payloads for downstream processing.

Required Methods§

Source

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

Runs the relay.

The relay context provides access primarily to the payloads dispatcher, used to send raw payloads to the next components in the topology, as well as other information such as the component context.

Relays 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§