pub struct PlatformSourceBuilder { /* private fields */ }Expand description
Builder for creating PlatformSource instances.
Provides a fluent API for constructing platform sources with sensible defaults.
§Example
ⓘ
use drasi_source_platform::PlatformSource;
let source = PlatformSource::builder("my-platform-source")
.with_redis_url("redis://localhost:6379")
.with_stream_key("my-app-changes")
.with_consumer_group("my-consumers")
.with_batch_size(50)
.build()?;Implementations§
Source§impl PlatformSourceBuilder
impl PlatformSourceBuilder
Sourcepub fn new(id: impl Into<String>) -> Self
pub fn new(id: impl Into<String>) -> Self
Create a new builder with the given ID and default values.
Sourcepub fn with_redis_url(self, url: impl Into<String>) -> Self
pub fn with_redis_url(self, url: impl Into<String>) -> Self
Sourcepub fn with_stream_key(self, key: impl Into<String>) -> Self
pub fn with_stream_key(self, key: impl Into<String>) -> Self
Sourcepub fn with_consumer_group(self, group: impl Into<String>) -> Self
pub fn with_consumer_group(self, group: impl Into<String>) -> Self
Sourcepub fn with_consumer_name(self, name: impl Into<String>) -> Self
pub fn with_consumer_name(self, name: impl Into<String>) -> Self
Set a unique consumer name within the group.
§Arguments
name- Unique consumer name (auto-generated if not specified)
Sourcepub fn with_batch_size(self, size: usize) -> Self
pub fn with_batch_size(self, size: usize) -> Self
Set the batch size for reading events.
§Arguments
size- Number of events to read per XREADGROUP call (default: 100)
Sourcepub fn with_block_ms(self, ms: u64) -> Self
pub fn with_block_ms(self, ms: u64) -> Self
Set the block timeout for waiting on events.
§Arguments
ms- Milliseconds to block waiting for events (default: 5000)
Sourcepub fn with_dispatch_mode(self, mode: DispatchMode) -> Self
pub fn with_dispatch_mode(self, mode: DispatchMode) -> Self
Set the dispatch mode for this source
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 for this source
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 this source
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_config(self, config: PlatformSourceConfig) -> Self
pub fn with_config(self, config: PlatformSourceConfig) -> Self
Set the full configuration at once
Sourcepub fn build(self) -> Result<PlatformSource>
pub fn build(self) -> Result<PlatformSource>
Auto Trait Implementations§
impl Freeze for PlatformSourceBuilder
impl !RefUnwindSafe for PlatformSourceBuilder
impl Send for PlatformSourceBuilder
impl Sync for PlatformSourceBuilder
impl Unpin for PlatformSourceBuilder
impl !UnwindSafe for PlatformSourceBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more