pub struct HttpSource { /* private fields */ }Expand description
HTTP source with configurable adaptive batching.
This source exposes HTTP endpoints for receiving data change events. It supports both single-event and batch submission modes, with adaptive batching for optimized throughput.
§Fields
base: Common source functionality (dispatchers, status, lifecycle)config: HTTP-specific configuration (host, port, timeout)adaptive_config: Adaptive batching settings for throughput optimization
Implementations§
Source§impl HttpSource
impl HttpSource
Sourcepub fn new(id: impl Into<String>, config: HttpSourceConfig) -> Result<Self>
pub fn new(id: impl Into<String>, config: HttpSourceConfig) -> Result<Self>
Create a new HTTP source.
The event channel is automatically injected when the source is added
to DrasiLib via add_source().
§Arguments
id- Unique identifier for this source instanceconfig- HTTP source configuration
§Returns
A new HttpSource instance, or an error if construction fails.
§Errors
Returns an error if the base source cannot be initialized.
§Example
use drasi_source_http::{HttpSource, HttpSourceBuilder};
let config = HttpSourceBuilder::new()
.with_host("0.0.0.0")
.with_port(8080)
.build();
let source = HttpSource::new("my-http-source", config)?;Sourcepub fn with_dispatch(
id: impl Into<String>,
config: HttpSourceConfig,
dispatch_mode: Option<DispatchMode>,
dispatch_buffer_capacity: Option<usize>,
) -> Result<Self>
pub fn with_dispatch( id: impl Into<String>, config: HttpSourceConfig, dispatch_mode: Option<DispatchMode>, dispatch_buffer_capacity: Option<usize>, ) -> Result<Self>
Create a new HTTP source with custom dispatch settings.
The event channel is automatically injected when the source is added
to DrasiLib via add_source().
§Arguments
id- Unique identifier for this source instanceconfig- HTTP source configurationdispatch_mode- Optional dispatch mode (Channel, Direct, etc.)dispatch_buffer_capacity- Optional buffer capacity for channel dispatch
§Returns
A new HttpSource instance with custom dispatch settings.
§Errors
Returns an error if the base source cannot be initialized.
Source§impl HttpSource
impl HttpSource
Sourcepub fn builder(id: impl Into<String>) -> HttpSourceBuilder
pub fn builder(id: impl Into<String>) -> HttpSourceBuilder
Create a builder for HttpSource with the given ID.
This is the recommended way to construct an HttpSource.
§Arguments
id- Unique identifier for the source instance
§Example
let source = HttpSource::builder("my-source")
.with_host("0.0.0.0")
.with_port(8080)
.with_bootstrap_provider(my_provider)
.build()?;Trait Implementations§
Source§impl Source for HttpSource
impl Source for HttpSource
Source§fn properties(&self) -> HashMap<String, Value>
fn properties(&self) -> HashMap<String, Value>
Source§fn auto_start(&self) -> bool
fn auto_start(&self) -> bool
Source§fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ComponentStatus> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ComponentStatus> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn subscribe<'life0, 'async_trait>(
&'life0 self,
settings: SourceSubscriptionSettings,
) -> Pin<Box<dyn Future<Output = Result<SubscriptionResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn subscribe<'life0, 'async_trait>(
&'life0 self,
settings: SourceSubscriptionSettings,
) -> Pin<Box<dyn Future<Output = Result<SubscriptionResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn initialize<'life0, 'async_trait>(
&'life0 self,
context: SourceRuntimeContext,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn initialize<'life0, 'async_trait>(
&'life0 self,
context: SourceRuntimeContext,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn set_bootstrap_provider<'life0, 'async_trait>(
&'life0 self,
provider: Box<dyn BootstrapProvider + 'static>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_bootstrap_provider<'life0, 'async_trait>(
&'life0 self,
provider: Box<dyn BootstrapProvider + 'static>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn dispatch_mode(&self) -> DispatchMode
fn dispatch_mode(&self) -> DispatchMode
Source§fn supports_replay(&self) -> bool
fn supports_replay(&self) -> bool
resume_from. Read more