=clt #17447 Split DistributedPubSub docs into java/scala

This commit is contained in:
Patrik Nordwall 2015-06-30 14:46:34 +02:00
parent a93de9bf37
commit 6e28229fbe
9 changed files with 172 additions and 43 deletions

View file

@ -102,7 +102,7 @@ The ``ClusterClientReceptionist`` can be configured with the following propertie
.. includecode:: ../../../akka-cluster-tools/src/main/resources/reference.conf#receptionist-ext-config
Note that the ``ClusterClientReceptionist`` uses the ``DistributedPubSub`` extension, which is described
in :ref:`distributed-pub-sub`.
in :ref:`distributed-pub-sub-scala`.
It is recommended to load the extension when the actor system is started by defining it in the
``akka.extensions`` configuration property::

View file

@ -325,7 +325,7 @@ Publish-subscribe messaging between actors in the cluster, and point-to-point me
using the logical path of the actors, i.e. the sender does not have to know on which
node the destination actor is running.
See :ref:`distributed-pub-sub` in the contrib module.
See :ref:`distributed-pub-sub-scala`.
Cluster Client
^^^^^^^^^^^^^^

View file

@ -1,4 +1,4 @@
.. _distributed-pub-sub:
.. _distributed-pub-sub-scala:
Distributed Publish Subscribe in Cluster
========================================
@ -12,18 +12,18 @@ This pattern provides a mediator actor, ``akka.cluster.pubsub.DistributedPubSubM
that 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,
The ``DistributedPubSubMediator`` actor 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`` or as an ordinary actor.
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.
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. 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.
You can send messages via the mediator on any node to registered actors on
any other node. There is four modes of message delivery.
any other node. There are four modes of message delivery.
**1. DistributedPubSubMediator.Send**
@ -79,28 +79,8 @@ Successful ``Subscribe`` and ``Unsubscribe`` is acknowledged with
``DistributedPubSubMediator.SubscribeAck`` and ``DistributedPubSubMediator.UnsubscribeAck``
replies.
A Small Example in Java
-----------------------
A subscriber actor:
.. includecode:: ../../../akka-cluster-tools/src/test/java/akka/cluster/pubsub/DistributedPubSubMediatorTest.java#subscriber
Subscriber actors can be started on several nodes in the cluster, and all will receive
messages published to the "content" topic.
.. includecode:: ../../../akka-cluster-tools/src/test/java/akka/cluster/pubsub/DistributedPubSubMediatorTest.java#start-subscribers
A simple actor that publishes to this "content" topic:
.. includecode:: ../../../akka-cluster-tools/src/test/java/akka/cluster/pubsub/DistributedPubSubMediatorTest.java#publisher
It can publish messages to the topic from anywhere in the cluster:
.. includecode:: ../../../akka-cluster-tools/src/test/java/akka/cluster/pubsub/DistributedPubSubMediatorTest.java#publish-message
A Small Example in Scala
------------------------
A Small Example
---------------
A subscriber actor:
@ -122,16 +102,16 @@ It can publish messages to the topic from anywhere in the cluster:
A more comprehensive sample is available in the `Typesafe Activator <http://www.typesafe.com/platform/getstarted>`_
tutorial named `Akka Clustered PubSub with Scala! <http://www.typesafe.com/activator/template/akka-clustering>`_.
DistributedPubSub
--------------------------
DistributedPubSub Extension
---------------------------
In the example above the mediator is started and accessed with the ``akka.cluster.pubsub.DistributedPubSub``.
In the example above the mediator is started and accessed with the ``akka.cluster.pubsub.DistributedPubSub`` extension.
That is convenient and perfectly fine in most cases, but it can be good to know that it is possible to
start the mediator actor as an ordinary actor and you can have several different mediators at the same
time to be able to divide a large number of actors/topics to different mediators. For example you might
want to use different cluster roles for different mediators.
The ``DistributedPubSub`` can be configured with the following properties:
The ``DistributedPubSub`` extension can be configured with the following properties:
.. includecode:: ../../../akka-cluster-tools/src/main/resources/reference.conf#pub-sub-ext-config

View file

@ -147,7 +147,7 @@ Similarly to `Actor Classification`_, :class:`EventStream` will automatically re
.. note::
The event stream is a *local facility*, meaning that it will *not* distribute events to other nodes in a clustered environment (unless you subscribe a Remote Actor to the stream explicitly).
If you need to broadcast events in an Akka cluster, *without* knowing your recipients explicitly (i.e. obtaining their ActorRefs), you may want to look into: :ref:`distributed-pub-sub`.
If you need to broadcast events in an Akka cluster, *without* knowing your recipients explicitly (i.e. obtaining their ActorRefs), you may want to look into: :ref:`distributed-pub-sub-scala`.
Default Handlers
----------------