Merge pull request #20227 from akka/wip-17458-pubsub-group-patriknw

clarify pubsub group docs, #17458
This commit is contained in:
Patrik Nordwall 2016-04-05 14:21:32 +02:00
commit fc9c853ade
2 changed files with 38 additions and 12 deletions

View file

@ -76,14 +76,27 @@ 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 .. includecode:: ../../../akka-cluster-tools/src/test/java/akka/cluster/pubsub/DistributedPubSubMediatorTest.java#publish-message
Actors may also be subscribed to a named topic with an optional property (``group``). Topic Groups
If subscribing with a group name, each message published to a topic with the ^^^^^^^^^^^^
(``sendOneMessageToEachGroup``) flag is delivered via the supplied ``RoutingLogic``
Actors may also be subscribed to a named topic with a ``group`` id.
If subscribing with a group id, each message published to a topic with the
``sendOneMessageToEachGroup`` flag set to ``true`` is delivered via the supplied ``RoutingLogic``
(default random) to one actor within each subscribing group. (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 subscriber. If all the subscribed actors have the same group id, then this works just like
``Send`` and each message is only delivered to one subscriber.
If all the subscribed actors have different group names, then this works like If all the subscribed actors have different group names, then this works like
normal ``Publish`` and all messages are broadcast to all subscribers. normal ``Publish`` and each message is broadcasted to all subscribers.
.. note::
Note that if the group id is used it is part of the topic identifier.
Messages published with ``sendOneMessageToEachGroup=false`` will not be delivered
to subscribers that subscribed with a group id.
Messages published with ``sendOneMessageToEachGroup=true`` will not be delivered
to subscribers that subscribed without a group id.
.. _distributed-pub-sub-send-java: .. _distributed-pub-sub-send-java:

View file

@ -79,14 +79,27 @@ It can publish messages to the topic from anywhere in the cluster:
.. includecode:: ../../../akka-cluster-tools/src/multi-jvm/scala/akka/cluster/pubsub/DistributedPubSubMediatorSpec.scala#publish-message .. includecode:: ../../../akka-cluster-tools/src/multi-jvm/scala/akka/cluster/pubsub/DistributedPubSubMediatorSpec.scala#publish-message
Actors may also be subscribed to a named topic with an optional property (``group``). Topic Groups
If subscribing with a group name, each message published to a topic with the ^^^^^^^^^^^^
(``sendOneMessageToEachGroup``) flag is delivered via the supplied ``RoutingLogic``
Actors may also be subscribed to a named topic with a ``group`` id.
If subscribing with a group id, each message published to a topic with the
``sendOneMessageToEachGroup`` flag set to ``true`` is delivered via the supplied ``RoutingLogic``
(default random) to one actor within each subscribing group. (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 subscriber. If all the subscribed actors have the same group id, then this works just like
``Send`` and each message is only delivered to one subscriber.
If all the subscribed actors have different group names, then this works like If all the subscribed actors have different group names, then this works like
normal ``Publish`` and all messages are broadcast to all subscribers. normal ``Publish`` and each message is broadcasted to all subscribers.
.. note::
Note that if the group id is used it is part of the topic identifier.
Messages published with ``sendOneMessageToEachGroup=false`` will not be delivered
to subscribers that subscribed with a group id.
Messages published with ``sendOneMessageToEachGroup=true`` will not be delivered
to subscribers that subscribed without a group id.
.. _distributed-pub-sub-send-scala: .. _distributed-pub-sub-send-scala: