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.