pub trait Decoder {
// Required method
fn run<'async_trait>(
self: Box<Self>,
context: DecoderContext,
) -> Pin<Box<dyn Future<Output = Result<(), GenericError>> + Send + 'async_trait>>
where Self: 'async_trait;
}Expand description
A decoder.
Decoders are the bridge between relays and the rest of the topology. They are responsible for decoding payloads into events that the rest of the topology can operate on. Decoders are generally specific to a particular system/protocol: while the codec used by one decoder might be the same as another decoder, the format of the payload is likely to be highly contextual and so decoders cannot easily be swapped in and out.
Examples of typical decoders include OTLP and DogStatsD.
Required Methods§
Sourcefn run<'async_trait>(
self: Box<Self>,
context: DecoderContext,
) -> Pin<Box<dyn Future<Output = Result<(), GenericError>> + Send + 'async_trait>>where
Self: 'async_trait,
fn run<'async_trait>(
self: Box<Self>,
context: DecoderContext,
) -> Pin<Box<dyn Future<Output = Result<(), GenericError>> + Send + 'async_trait>>where
Self: 'async_trait,
Runs the decoder.
The decoder context provides access primarily to the payload stream, used to receive payloads sent to the decoder, and the dispatcher, used to send events to the downstream component in the topology, as well as other information such as the component context.
Decoders are expected to run indefinitely until their payload stream is terminated, or an error occurs.
§Errors
If an unrecoverable error occurs while running, an error is returned.