Skip to main content

Module event_queue

Module event_queue 

Source
Expand description

Event queue for server-side streaming.

The executor writes StreamResponse events to an EventQueueWriter; the HTTP layer reads them from an EventQueueReader and serializes them as SSE frames.

InMemoryQueueWriter and InMemoryQueueReader are backed by a tokio::sync::broadcast channel, enabling multiple concurrent readers (fan-out) for the same event stream. This allows SubscribeToTask (resubscribe) to work even when another SSE stream is already active.

Structs§

EventQueueManager
Manages event queues for active tasks.
InMemoryQueueReader
In-memory EventQueueReader backed by a broadcast channel receiver.
InMemoryQueueWriter
In-memory EventQueueWriter backed by a broadcast channel sender.

Constants§

DEFAULT_MAX_EVENT_SIZE
Default maximum event size in bytes (16 MiB).
DEFAULT_QUEUE_CAPACITY
Default channel capacity for event queues.
DEFAULT_WRITE_TIMEOUT
Default write timeout for event queue sends (5 seconds).

Traits§

EventQueueReader
Trait for reading streaming events.
EventQueueWriter
Trait for writing streaming events.

Functions§

new_in_memory_queue
Creates a new in-memory event queue pair with the default capacity, default max event size, and default write timeout.
new_in_memory_queue_with_capacity
Creates a new in-memory event queue pair with the specified capacity and default max event size / write timeout.
new_in_memory_queue_with_options
Creates a new in-memory event queue pair with the specified capacity, maximum event size, and write timeout.
new_in_memory_queue_with_persistence
Creates a new in-memory event queue pair with a dedicated persistence channel.