pub struct TopicRouter { /* private fields */ }Expand description
Topic exchange router for AMQP-style topic routing
Routes messages based on topic patterns with wildcards.
Implementations§
Source§impl TopicRouter
impl TopicRouter
Sourcepub fn bind(&mut self, pattern: impl Into<String>, queue: impl Into<String>)
pub fn bind(&mut self, pattern: impl Into<String>, queue: impl Into<String>)
Bind a topic pattern to a queue
Sourcepub fn bind_many(&mut self, patterns: Vec<String>, queue: impl Into<String>)
pub fn bind_many(&mut self, patterns: Vec<String>, queue: impl Into<String>)
Bind multiple patterns to a queue
Sourcepub fn set_default_queue(&mut self, queue: impl Into<String>)
pub fn set_default_queue(&mut self, queue: impl Into<String>)
Set default queue for unmatched routing keys
Sourcepub fn route(&self, routing_key: &str) -> Option<String>
pub fn route(&self, routing_key: &str) -> Option<String>
Route a message based on routing key
Returns the first matching queue, or the default queue if no match.
Sourcepub fn route_all(&self, routing_key: &str) -> Vec<String>
pub fn route_all(&self, routing_key: &str) -> Vec<String>
Get all queues that match a routing key
Sourcepub fn unbind_queue(&mut self, queue: &str) -> usize
pub fn unbind_queue(&mut self, queue: &str) -> usize
Remove all bindings for a queue
Sourcepub fn unbind_pattern(&mut self, pattern: &str) -> bool
pub fn unbind_pattern(&mut self, pattern: &str) -> bool
Remove a specific binding
Sourcepub const fn binding_count(&self) -> usize
pub const fn binding_count(&self) -> usize
Get number of bindings
Trait Implementations§
Source§impl Clone for TopicRouter
impl Clone for TopicRouter
Source§fn clone(&self) -> TopicRouter
fn clone(&self) -> TopicRouter
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 moreSource§impl Debug for TopicRouter
impl Debug for TopicRouter
Auto Trait Implementations§
impl Freeze for TopicRouter
impl RefUnwindSafe for TopicRouter
impl Send for TopicRouter
impl Sync for TopicRouter
impl Unpin for TopicRouter
impl UnwindSafe for TopicRouter
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