pub struct MessageRouter { /* private fields */ }Expand description
Router for directing messages to queues
Implementations§
Source§impl MessageRouter
impl MessageRouter
Sourcepub fn new(default_queue: impl Into<String>) -> Self
pub fn new(default_queue: impl Into<String>) -> Self
Create a new message router with a default queue
Sourcepub fn add_rule(&mut self, rule: RoutingRule)
pub fn add_rule(&mut self, rule: RoutingRule)
Add a routing rule
Sourcepub fn route(&mut self, pattern: impl Into<String>, queue: impl Into<String>)
pub fn route(&mut self, pattern: impl Into<String>, queue: impl Into<String>)
Add a simple routing rule (pattern -> queue)
Sourcepub fn get_queue_for_task(&self, task_name: &str) -> &str
pub fn get_queue_for_task(&self, task_name: &str) -> &str
Get the queue name for a task name
Sourcepub fn get_routing_key(&self, message: &Message) -> Option<&str>
pub fn get_routing_key(&self, message: &Message) -> Option<&str>
Get the routing key for a message
Sourcepub fn get_exchange(&self, message: &Message) -> Option<&str>
pub fn get_exchange(&self, message: &Message) -> Option<&str>
Get the exchange for a message
Trait Implementations§
Source§impl Clone for MessageRouter
impl Clone for MessageRouter
Source§fn clone(&self) -> MessageRouter
fn clone(&self) -> MessageRouter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MessageRouter
impl RefUnwindSafe for MessageRouter
impl Send for MessageRouter
impl Sync for MessageRouter
impl Unpin for MessageRouter
impl UnwindSafe for MessageRouter
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