pub struct PlatformSource { /* private fields */ }Expand description
Platform source that reads events from Redis Streams.
This source connects to a Redis instance and consumes CloudEvent-wrapped messages from a stream using consumer groups. It supports both data events (node/relation changes) and control events (query subscriptions).
§Fields
base: Common source functionality (dispatchers, status, lifecycle)config: Platform-specific configuration (Redis connection, stream settings)
Implementations§
Source§impl PlatformSource
impl PlatformSource
Sourcepub fn builder(id: impl Into<String>) -> PlatformSourceBuilder
pub fn builder(id: impl Into<String>) -> PlatformSourceBuilder
Sourcepub fn new(id: impl Into<String>, config: PlatformSourceConfig) -> Result<Self>
pub fn new(id: impl Into<String>, config: PlatformSourceConfig) -> Result<Self>
Create a new platform 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- Platform source configuration
§Returns
A new PlatformSource instance, or an error if construction fails.
§Errors
Returns an error if the base source cannot be initialized.
§Example
use drasi_source_platform::{PlatformSource, PlatformSourceBuilder};
let config = PlatformSourceBuilder::new("my-platform-source")
.with_redis_url("redis://localhost:6379")
.with_stream_key("my-changes")
.build()?;Source§impl PlatformSource
impl PlatformSource
Sourcepub fn test_subscribe(&self) -> Box<dyn ChangeReceiver<SourceEventWrapper>>
pub fn test_subscribe(&self) -> Box<dyn ChangeReceiver<SourceEventWrapper>>
Create a test subscription to this source (synchronous)
This method delegates to SourceBase and is provided for convenience in tests. Note: Use test_subscribe_async() in async contexts to avoid runtime issues.
Sourcepub async fn test_subscribe_async(
&self,
) -> Box<dyn ChangeReceiver<SourceEventWrapper>>
pub async fn test_subscribe_async( &self, ) -> Box<dyn ChangeReceiver<SourceEventWrapper>>
Create a test subscription to this source (async)
This method delegates to SourceBase and is provided for convenience in async tests. Prefer this method over test_subscribe() in async contexts.
Trait Implementations§
Source§impl Source for PlatformSource
impl Source for PlatformSource
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