pub struct CommandQueue { /* private fields */ }Expand description
Command queue
Implementations§
Source§impl CommandQueue
impl CommandQueue
Sourcepub fn new(event_emitter: EventEmitter) -> Self
pub fn new(event_emitter: EventEmitter) -> Self
Create a new command queue
Sourcepub fn with_dlq(event_emitter: EventEmitter, dlq_size: usize) -> Self
pub fn with_dlq(event_emitter: EventEmitter, dlq_size: usize) -> Self
Create a new command queue with a dead letter queue
Sourcepub fn with_storage(
event_emitter: EventEmitter,
storage: Arc<dyn Storage>,
) -> Self
pub fn with_storage( event_emitter: EventEmitter, storage: Arc<dyn Storage>, ) -> Self
Create a new command queue with storage
Sourcepub fn with_dlq_and_storage(
event_emitter: EventEmitter,
dlq_size: usize,
storage: Arc<dyn Storage>,
) -> Self
pub fn with_dlq_and_storage( event_emitter: EventEmitter, dlq_size: usize, storage: Arc<dyn Storage>, ) -> Self
Create a new command queue with both DLQ and storage
Sourcepub fn dlq(&self) -> Option<&DeadLetterQueue>
pub fn dlq(&self) -> Option<&DeadLetterQueue>
Get the dead letter queue
Sourcepub fn is_shutting_down(&self) -> bool
pub fn is_shutting_down(&self) -> bool
Check if shutdown is in progress
Sourcepub async fn drain(&self, timeout: Duration) -> Result<()>
pub async fn drain(&self, timeout: Duration) -> Result<()>
Wait for all pending commands to complete (with timeout)
Sourcepub async fn register_lane(&self, lane: Arc<Lane>)
pub async fn register_lane(&self, lane: Arc<Lane>)
Register a lane
Sourcepub async fn submit(
&self,
lane_id: &str,
command: Box<dyn Command>,
) -> Result<Receiver<Result<Value>>>
pub async fn submit( &self, lane_id: &str, command: Box<dyn Command>, ) -> Result<Receiver<Result<Value>>>
Submit a command to a lane
Sourcepub async fn start_scheduler(self: Arc<Self>)
pub async fn start_scheduler(self: Arc<Self>)
Start the scheduler
Sourcepub fn subscribe_stream(&self) -> EventStream
pub fn subscribe_stream(&self) -> EventStream
Subscribe to all queue lifecycle events as an EventStream (implements Stream)
Sourcepub fn subscribe_filtered(
&self,
filter: impl Fn(&LaneEvent) -> bool + Send + Sync + 'static,
) -> EventStream
pub fn subscribe_filtered( &self, filter: impl Fn(&LaneEvent) -> bool + Send + Sync + 'static, ) -> EventStream
Subscribe to filtered queue lifecycle events as an EventStream
Sourcepub async fn status(&self) -> HashMap<LaneId, LaneStatus>
pub async fn status(&self) -> HashMap<LaneId, LaneStatus>
Get queue status for all lanes
Auto Trait Implementations§
impl Freeze for CommandQueue
impl !RefUnwindSafe for CommandQueue
impl Send for CommandQueue
impl Sync for CommandQueue
impl Unpin for CommandQueue
impl UnsafeUnpin for CommandQueue
impl !UnwindSafe for CommandQueue
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