pub trait Source: Send + Sync {
// Required methods
fn id(&self) -> &str;
fn run<'async_trait>(
self: Box<Self>,
tx: Sender<Envelope>,
cancel: CancellationToken,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait;
// Provided method
fn set_node_ctx(&mut self, _ctx: NodeCtx) { ... }
}Expand description
A pipeline source.
Drives its own cadence (polling, streaming, event-driven) and pushes
envelopes into tx. When cancel fires, the implementation must exit
promptly; dropping tx on exit signals downstream stages to drain.
Required Methods§
fn id(&self) -> &str
fn run<'async_trait>(
self: Box<Self>,
tx: Sender<Envelope>,
cancel: CancellationToken,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
Provided Methods§
Sourcefn set_node_ctx(&mut self, _ctx: NodeCtx)
fn set_node_ctx(&mut self, _ctx: NodeCtx)
Attach the per-node observability context. Called by
spawn_pipeline after the source is built but before it runs.
Default no-op for custom sources that do not use SourceCtx.