pub struct HttpSourceBuilder { /* private fields */ }Expand description
Builder for HttpSource instances.
Provides a fluent API for constructing HTTP sources with sensible defaults
and adaptive batching settings. The builder takes the source ID at construction
and returns a fully constructed HttpSource from build().
§Example
use drasi_source_http::HttpSource;
let source = HttpSource::builder("my-source")
.with_host("0.0.0.0")
.with_port(8080)
.with_adaptive_enabled(true)
.with_bootstrap_provider(my_provider)
.build()?;Implementations§
Source§impl HttpSourceBuilder
impl HttpSourceBuilder
Sourcepub fn new(id: impl Into<String>) -> Self
pub fn new(id: impl Into<String>) -> Self
Create a new HTTP source builder with the given source ID.
§Arguments
id- Unique identifier for the source instance
Sourcepub fn with_endpoint(self, endpoint: impl Into<String>) -> Self
pub fn with_endpoint(self, endpoint: impl Into<String>) -> Self
Set the endpoint path
Sourcepub fn with_timeout_ms(self, timeout_ms: u64) -> Self
pub fn with_timeout_ms(self, timeout_ms: u64) -> Self
Set the request timeout in milliseconds
Sourcepub fn with_adaptive_max_batch_size(self, size: usize) -> Self
pub fn with_adaptive_max_batch_size(self, size: usize) -> Self
Set the adaptive batching maximum batch size
Sourcepub fn with_adaptive_min_batch_size(self, size: usize) -> Self
pub fn with_adaptive_min_batch_size(self, size: usize) -> Self
Set the adaptive batching minimum batch size
Sourcepub fn with_adaptive_max_wait_ms(self, wait_ms: u64) -> Self
pub fn with_adaptive_max_wait_ms(self, wait_ms: u64) -> Self
Set the adaptive batching maximum wait time in milliseconds
Sourcepub fn with_adaptive_min_wait_ms(self, wait_ms: u64) -> Self
pub fn with_adaptive_min_wait_ms(self, wait_ms: u64) -> Self
Set the adaptive batching minimum wait time in milliseconds
Sourcepub fn with_adaptive_window_secs(self, secs: u64) -> Self
pub fn with_adaptive_window_secs(self, secs: u64) -> Self
Set the adaptive batching throughput window in seconds
Sourcepub fn with_adaptive_enabled(self, enabled: bool) -> Self
pub fn with_adaptive_enabled(self, enabled: bool) -> Self
Enable or disable adaptive batching
Sourcepub fn with_dispatch_mode(self, mode: DispatchMode) -> Self
pub fn with_dispatch_mode(self, mode: DispatchMode) -> Self
Set the dispatch mode for event routing.
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 for initial data delivery.
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 when DrasiLib starts.
Default is true. Set to false if this source should only be
started manually via start_source().
Sourcepub fn with_webhooks(self, webhooks: WebhookConfig) -> Self
pub fn with_webhooks(self, webhooks: WebhookConfig) -> Self
Set the webhook configuration to enable webhook mode.
When webhook mode is enabled, the standard HttpSourceChange endpoints
are disabled and custom webhook routes are used instead.
Sourcepub fn with_config(self, config: HttpSourceConfig) -> Self
pub fn with_config(self, config: HttpSourceConfig) -> Self
Set the full configuration at once
Sourcepub fn build(self) -> Result<HttpSource>
pub fn build(self) -> Result<HttpSource>
Build the HttpSource instance.
§Returns
A fully constructed HttpSource, or an error if construction fails.