pub struct SourceBaseParams {
pub id: String,
pub dispatch_mode: Option<DispatchMode>,
pub dispatch_buffer_capacity: Option<usize>,
pub bootstrap_provider: Option<Box<dyn BootstrapProvider + 'static>>,
pub auto_start: bool,
}Expand description
Base implementations for source and reaction plugins These are used by plugin developers, not by drasi-lib itself Parameters for creating a SourceBase instance.
This struct contains only the information that SourceBase needs to function. Plugin-specific configuration should remain in the plugin crate.
§Example
use drasi_lib::sources::base::{SourceBase, SourceBaseParams};
let params = SourceBaseParams::new("my-source")
.with_dispatch_mode(DispatchMode::Channel)
.with_dispatch_buffer_capacity(2000)
.with_bootstrap_provider(my_provider);
let base = SourceBase::new(params)?;Fields§
§id: StringUnique identifier for the source
dispatch_mode: Option<DispatchMode>Dispatch mode (Broadcast or Channel) - defaults to Channel
dispatch_buffer_capacity: Option<usize>Dispatch buffer capacity - defaults to 1000
bootstrap_provider: Option<Box<dyn BootstrapProvider + 'static>>Optional bootstrap provider to set during construction
auto_start: boolWhether this source should auto-start - defaults to true
Implementations§
Source§impl SourceBaseParams
impl SourceBaseParams
Sourcepub fn new(id: impl Into<String>) -> Self
pub fn new(id: impl Into<String>) -> Self
Create new params with just an ID, using defaults for everything else
Sourcepub fn with_dispatch_mode(self, mode: DispatchMode) -> Self
pub fn with_dispatch_mode(self, mode: DispatchMode) -> Self
Set the dispatch mode
Sourcepub fn with_dispatch_buffer_capacity(self, capacity: usize) -> Self
pub fn with_dispatch_buffer_capacity(self, capacity: usize) -> Self
Set the dispatch buffer capacity
Sourcepub fn with_bootstrap_provider(
self,
provider: impl BootstrapProvider + 'static,
) -> Self
pub fn with_bootstrap_provider( self, provider: impl BootstrapProvider + 'static, ) -> Self
Set the bootstrap provider
This provider will be used during source subscription to deliver initial data to queries that request bootstrap.
Sourcepub fn with_auto_start(self, auto_start: bool) -> Self
pub fn with_auto_start(self, auto_start: bool) -> Self
Set whether this source should auto-start
Default is true. Set to false if this source should only be
started manually via start_source().