pub struct DistributedPubSub { /* private fields */ }Implementations§
Source§impl DistributedPubSub
impl DistributedPubSub
pub fn new() -> Arc<Self>
Sourcepub fn subscribe<M: Clone + Send + 'static>(
&self,
topic: impl Into<String>,
subscriber: ActorRef<M>,
)
pub fn subscribe<M: Clone + Send + 'static>( &self, topic: impl Into<String>, subscriber: ActorRef<M>, )
Subscribe subscriber: ActorRef<M> to topic. Future
publish_msg::<M>(topic, msg) calls deliver to it.
Sourcepub fn subscribe_to_group<M: Clone + Send + 'static>(
&self,
topic: impl Into<String>,
group: impl Into<String>,
subscriber: ActorRef<M>,
)
pub fn subscribe_to_group<M: Clone + Send + 'static>( &self, topic: impl Into<String>, group: impl Into<String>, subscriber: ActorRef<M>, )
Subscribe to a (topic, group) bucket. send_to_group
rotates through bucket members.
Sourcepub fn unsubscribe(&self, topic: &str, subscriber_path: &ActorPath)
pub fn unsubscribe(&self, topic: &str, subscriber_path: &ActorPath)
Drop a subscriber by path from a topic.
Sourcepub fn publish(&self, topic: &str) -> Vec<UntypedActorRef>
pub fn publish(&self, topic: &str) -> Vec<UntypedActorRef>
Snapshot of subscriber refs for a topic. Useful for tests + the legacy “discover, then send” pattern.
Sourcepub fn publish_msg<M: Clone + Send + 'static>(
&self,
topic: &str,
msg: M,
) -> usize
pub fn publish_msg<M: Clone + Send + 'static>( &self, topic: &str, msg: M, ) -> usize
Typed broadcast. Delivers msg (cloned) to every subscriber
of topic. Returns the number of successful deliveries.
Sourcepub fn send_to_group<M: Clone + Send + 'static>(
&self,
topic: &str,
group: &str,
msg: M,
) -> bool
pub fn send_to_group<M: Clone + Send + 'static>( &self, topic: &str, group: &str, msg: M, ) -> bool
Pick one member of (topic, group) round-robin and deliver
msg. Returns true if a recipient was found.
pub fn topic_count(&self) -> usize
pub fn group_count(&self) -> usize
Trait Implementations§
Source§impl Default for DistributedPubSub
impl Default for DistributedPubSub
Source§fn default() -> DistributedPubSub
fn default() -> DistributedPubSub
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for DistributedPubSub
impl !RefUnwindSafe for DistributedPubSub
impl Send for DistributedPubSub
impl Sync for DistributedPubSub
impl Unpin for DistributedPubSub
impl UnsafeUnpin for DistributedPubSub
impl !UnwindSafe for DistributedPubSub
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