pub struct EventStream { /* private fields */ }Expand description
Event stream with broadcast capability for real-time subscribers
Implementations§
Source§impl EventStream
impl EventStream
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create event stream with custom channel capacity
Sourcepub fn append(
&self,
event_type: EventType,
workflow_id: WorkflowId,
data: JsonValue,
) -> Event
pub fn append( &self, event_type: EventType, workflow_id: WorkflowId, data: JsonValue, ) -> Event
Append a new event and broadcast to all subscribers
Sourcepub fn append_with_parent(
&self,
event_type: EventType,
workflow_id: WorkflowId,
parent_workflow_id: Option<WorkflowId>,
data: JsonValue,
) -> Event
pub fn append_with_parent( &self, event_type: EventType, workflow_id: WorkflowId, parent_workflow_id: Option<WorkflowId>, data: JsonValue, ) -> Event
Append event with optional parent workflow ID
Sourcepub fn subscribe(&self) -> Receiver<Event>
pub fn subscribe(&self) -> Receiver<Event>
Subscribe to real-time event stream Returns a receiver that will get all future events
Sourcepub fn from_offset(&self, offset: EventOffset) -> Vec<Event>
pub fn from_offset(&self, offset: EventOffset) -> Vec<Event>
Get events from a specific offset (for replay)
pub fn is_empty(&self) -> bool
Sourcepub fn current_offset(&self) -> EventOffset
pub fn current_offset(&self) -> EventOffset
Get the current offset (next event will have this offset)
Trait Implementations§
Source§impl Clone for EventStream
impl Clone for EventStream
Auto Trait Implementations§
impl Freeze for EventStream
impl !RefUnwindSafe for EventStream
impl Send for EventStream
impl Sync for EventStream
impl Unpin for EventStream
impl !UnwindSafe for EventStream
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