pub struct PriorityRouter { /* private fields */ }Expand description
Priority-based message router
Implementations§
Source§impl PriorityRouter
impl PriorityRouter
pub fn new(default_queue: String) -> Self
Sourcepub fn add_queue(&mut self, name: String, queue: Arc<PriorityQueue>)
pub fn add_queue(&mut self, name: String, queue: Arc<PriorityQueue>)
Add a priority queue for a specific topic/route
Sourcepub fn route_message(
&self,
queue_name: Option<String>,
message: PriorityMessage,
) -> Result<()>
pub fn route_message( &self, queue_name: Option<String>, message: PriorityMessage, ) -> Result<()>
Route message to appropriate priority queue
Sourcepub async fn dequeue_any(&self) -> Option<(String, PriorityMessage)>
pub async fn dequeue_any(&self) -> Option<(String, PriorityMessage)>
Get message from highest priority across all queues
Sourcepub fn queue_names(&self) -> Vec<String>
pub fn queue_names(&self) -> Vec<String>
Get all queue names
Sourcepub fn aggregate_stats(&self) -> HashMap<String, PriorityQueueStats>
pub fn aggregate_stats(&self) -> HashMap<String, PriorityQueueStats>
Get aggregate statistics across all queues
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PriorityRouter
impl RefUnwindSafe for PriorityRouter
impl Send for PriorityRouter
impl Sync for PriorityRouter
impl Unpin for PriorityRouter
impl UnwindSafe for PriorityRouter
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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