Search Results for

    Show / Hide Table of Contents

    Class DistributedPubSubMediator

    This actor manages a registry of actor references and replicates the entries to peer actors among all cluster nodes or a group of nodes tagged with a specific role.

    The DistributedPubSubMediator is supposed to be started on all nodes, or all nodes with specified role, in the cluster. The mediator can be started with the DistributedPubSub extension or as an ordinary actor.

    Changes are only performed in the own part of the registry and those changes are versioned. Deltas are disseminated in a scalable way to other nodes with a gossip protocol. The registry is eventually consistent, i.e. changes are not immediately visible at other nodes, but typically they will be fully replicated to all other nodes after a few seconds.

    You can send messages via the mediator on any node to registered actors on any other node. There is three modes of message delivery.

    1. Send - The message will be delivered to one recipient with a matching path, if any such exists in the registry. If several entries match the path the message will be sent via the supplied `routingLogic` (default random) to one destination. The sender of the message can specify that local affinity is preferred, i.e. the message is sent to an actor in the same local actor system as the used mediator actor, if any such exists, otherwise route to any other matching entry. A typical usage of this mode is private chat to one other user in an instant messaging application. It can also be used for distributing tasks to registered workers, like a cluster aware router where the routees dynamically can register themselves.

    2. SendToAll - The message will be delivered to all recipients with a matching path. Actors with the same path, without address information, can be registered on different nodes. On each node there can only be one such actor, since the path is unique within one local actor system. Typical usage of this mode is to broadcast messages to all replicas with the same path, e.g. 3 actors on different nodes that all perform the same actions, for redundancy.

    3. Publish - Actors may be registered to a named topic instead of path. This enables many subscribers on each node. The message will be delivered to all subscribers of the topic. For efficiency the message is sent over the wire only once per node (that has a matching topic), and then delivered to all subscribers of the local topic representation. This is the true pub/sub mode. A typical usage of this mode is a chat room in an instant messaging application.

    4. Publish with sendOneMessageToEachGroup - Actors may be subscribed to a named topic with an optional property `group`. If subscribing with a group name, each message published to a topic with the `sendOneMessageToEachGroup` flag is delivered via the supplied `routingLogic` (default random) to one actor within each subscribing group. If all the subscribed actors have the same group name, then this works just like Send and all messages are delivered to one subscribe. If all the subscribed actors have different group names, then this works like normal Publish and all messages are broadcast to all subscribers.

    You register actors to the local mediator with Put or Subscribe. `Put` is used together with `Send` and `SendToAll` message delivery modes. The `ActorRef` in `Put` must belong to the same local actor system as the mediator. `Subscribe` is used together with `Publish`. Actors are automatically removed from the registry when they are terminated, or you can explicitly remove entries with Remove or Unsubscribe.

    Successful `Subscribe` and `Unsubscribe` is acknowledged with SubscribeAck and UnsubscribeAck replies.

    Inheritance
    object
    ActorBase
    UntypedActor
    ReceiveActor
    DistributedPubSubMediator
    Implements
    IInternalActor
    IInitializableActor
    Inherited Members
    ReceiveActor.OnReceive(object)
    ReceiveActor.Become(Action)
    ReceiveActor.BecomeStacked(Action)
    ReceiveActor.ReceiveAsync<T>(Func<T, Task>, Predicate<T>)
    ReceiveActor.ReceiveAsync<T>(Predicate<T>, Func<T, Task>)
    ReceiveActor.ReceiveAsync(Type, Func<object, Task>, Predicate<object>)
    ReceiveActor.ReceiveAsync(Type, Predicate<object>, Func<object, Task>)
    ReceiveActor.ReceiveAnyAsync(Func<object, Task>)
    ReceiveActor.Receive<T>(Action<T>, Predicate<T>)
    ReceiveActor.Receive<T>(Predicate<T>, Action<T>)
    ReceiveActor.Receive(Type, Action<object>, Predicate<object>)
    ReceiveActor.Receive(Type, Predicate<object>, Action<object>)
    ReceiveActor.Receive<T>(Func<T, bool>)
    ReceiveActor.Receive(Type, Func<object, bool>)
    ReceiveActor.ReceiveAny(Action<object>)
    UntypedActor.Receive(object)
    UntypedActor.RunTask(Action)
    UntypedActor.RunTask(Func<Task>)
    UntypedActor.Become(UntypedReceive)
    UntypedActor.BecomeStacked(UntypedReceive)
    UntypedActor.Context
    ActorBase.Sender
    ActorBase.Self
    ActorBase.AroundReceive(Receive, object)
    ActorBase.EmptyReceive
    ActorBase.Unhandled(object)
    ActorBase.Become(Receive)
    ActorBase.BecomeStacked(Receive)
    ActorBase.UnbecomeStacked()
    ActorBase.SetReceiveTimeout(TimeSpan?)
    ActorBase.AroundPreRestart(Exception, object)
    ActorBase.AroundPreStart()
    ActorBase.AroundPostRestart(Exception, object)
    ActorBase.PreRestart(Exception, object)
    ActorBase.PostRestart(Exception)
    ActorBase.AroundPostStop()
    ActorBase.SupervisorStrategy()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Akka.Cluster.Tools.PublishSubscribe
    Assembly: Akka.Cluster.Tools.dll
    Syntax
    public class DistributedPubSubMediator : ReceiveActor, IInternalActor, IInitializableActor

    Constructors

    | Edit this page View Source

    DistributedPubSubMediator(DistributedPubSubSettings)

    TBD

    Declaration
    public DistributedPubSubMediator(DistributedPubSubSettings settings)
    Parameters
    Type Name Description
    DistributedPubSubSettings settings

    TBD

    Exceptions
    Type Condition
    ArgumentException

    TBD

    Properties

    | Edit this page View Source

    Log

    TBD

    Declaration
    public ILoggingAdapter Log { get; }
    Property Value
    Type Description
    ILoggingAdapter
    | Edit this page View Source

    OwnVersions

    TBD

    Declaration
    public IImmutableDictionary<Address, long> OwnVersions { get; }
    Property Value
    Type Description
    IImmutableDictionary<Address, long>

    Methods

    | Edit this page View Source

    PostStop()

    TBD

    Declaration
    protected override void PostStop()
    Overrides
    ActorBase.PostStop()
    | Edit this page View Source

    PreStart()

    TBD

    Declaration
    protected override void PreStart()
    Overrides
    ActorBase.PreStart()
    | Edit this page View Source

    Props(DistributedPubSubSettings)

    TBD

    Declaration
    public static Props Props(DistributedPubSubSettings settings)
    Parameters
    Type Name Description
    DistributedPubSubSettings settings

    TBD

    Returns
    Type Description
    Props

    TBD

    Implements

    IInternalActor
    IInitializableActor

    Extension Methods

    ObjectExtensions.IsDefaultForType<T>(T)
    ObjectExtensions.AsOption<T>(T)
    Extensions.AsInstanceOf<T>(object)
    In this article
    • githubEdit this page
    • View Source
    Back to top
    Contribute
    • Project Chat
    • Discussion Forum
    • Source Code
    Support
    • Akka.NET Support Plans
    • Akka.NET Observability Tools
    • Akka.NET Training & Consulting
    Maintained By
    • Petabridge - The Akka.NET Company
    • Learn Akka.NET