Skip to main content

SourceFactory

Trait SourceFactory 

Source
pub trait SourceFactory: Send + Sync {
    // Required method
    fn build(
        &self,
        id: &str,
        config: Value,
        retry: Option<RetryPolicy>,
    ) -> Result<Box<dyn Source>>;
}
Expand description

Builds a Box<dyn Source> from a JSON spec. Polling sources receive an optional RetryPolicy extracted from SourceSpec; push-based sources (kafka, http_webhook) reject it at factory time so users don’t think retry is doing something it isn’t.

Required Methods§

Source

fn build( &self, id: &str, config: Value, retry: Option<RetryPolicy>, ) -> Result<Box<dyn Source>>

Implementors§

Source§

impl<F> SourceFactory for F
where F: Fn(&str, Value, Option<RetryPolicy>) -> Result<Box<dyn Source>> + Send + Sync,