pub struct ActorPubSub;Expand description
pg-backed PubSub bridge.
Ractor’s pg process groups are the natural local primitive for named actor
subscriber sets. A PubSub source joins its materialized actor to a pg group;
a PubSub sink broadcasts to the current members of that group. Groups are
expected to be type-homogeneous for the ActorSourceMessage<T> protocol.
Implementations§
Source§impl ActorPubSub
impl ActorPubSub
Sourcepub fn source<T>(
group: impl Into<String>,
) -> Source<T, ActorRef<ActorSourceMessage<T>>>where
T: Send + 'static,
pub fn source<T>(
group: impl Into<String>,
) -> Source<T, ActorRef<ActorSourceMessage<T>>>where
T: Send + 'static,
Creates a source whose materialized actor joins a Ractor pg group.
Messages broadcast by ActorPubSub::sink to the same group are emitted
by this source.
Sourcepub fn sink<T>(group: impl Into<String>) -> Sink<T, StreamCompletion<NotUsed>>
pub fn sink<T>(group: impl Into<String>) -> Sink<T, StreamCompletion<NotUsed>>
Broadcasts each stream element to current members of a Ractor pg group.
Group members are expected to be actors accepting
ActorSourceMessage<T>. Members that terminate before Ractor’s pg
membership catches up are skipped so one stale entry does not prevent
delivery to the remaining subscribers.