RuntimeStreamAdapter

Best-effort live fan-out of events across run / session / provider rooms.

RuntimeStreamAdapter

Best-effort live fan-out.

RuntimeStreamAdapter delivers events to live subscribers as they are emitted. Unlike RuntimeEventStore, it does not persist; subscribers that come online after an event is emitted miss it (use RuntimeEventStore + RuntimeSubscriptionHub for the durable path).

The full file is src/runtime/stream_adapter.rs.

Trait

#[async_trait]
pub trait RuntimeStreamAdapter: Send + Sync {
    async fn publish(&self, envelope: RuntimeEventEnvelope) -> Result<(), RuntimeStreamError>;
    fn subscribe(&self, room: RuntimeRoom) -> BoxRuntimeEventStream;
}

Backends

  • MemoryRuntimeStreamAdapter — tokio broadcast channel; default.
  • RedisRuntimeStreamAdapter — Redis Pub/Sub; feature redis.
  • NatsJetStreamStreamAdapter — NATS JetStream, per-room stream with ephemeral pull consumer; feature nats.
  • FailingRuntimeStreamAdapter — for tests.

See also

Related components

Edit this page on GitHub →