diff --git a/akka-docs/rst/java/routing.rst b/akka-docs/rst/java/routing.rst index 6ecde18c1b..665b94847d 100644 --- a/akka-docs/rst/java/routing.rst +++ b/akka-docs/rst/java/routing.rst @@ -311,6 +311,20 @@ with a ``thread-pool-executor`` hinting the number of allocated threads explicit .. includecode:: ../scala/code/docs/routing/RouterDocSpec.scala#config-balancing-pool3 +It is also possible to change the ``mailbox`` used by the balancing dispatcher for +scenarios where the default unbounded mailbox is not well suited. An example of such +a scenario could arise whether there exists the need to manage priority for each message. +You can then implement a priority mailbox and configure your dispatcher: + +.. includecode:: ../scala/code/docs/routing/RouterDocSpec.scala#config-balancing-pool4 + +.. note:: + + Bear in mind that ``BalancingDispatcher`` requires a message queue that must be thread-safe for + multiple concurrent consumers. So it is mandatory for the message queue backing a custom mailbox + for this kind of dispatcher to implement akka.dispatch.MultipleConsumerSemantics. See details + on how to implement your custom mailbox in :ref:`mailboxes-java`. + There is no Group variant of the BalancingPool. SmallestMailboxPool diff --git a/akka-docs/rst/scala/code/docs/routing/RouterDocSpec.scala b/akka-docs/rst/scala/code/docs/routing/RouterDocSpec.scala index 29b13a85ba..40de0a8645 100644 --- a/akka-docs/rst/scala/code/docs/routing/RouterDocSpec.scala +++ b/akka-docs/rst/scala/code/docs/routing/RouterDocSpec.scala @@ -101,6 +101,18 @@ akka.actor.deployment { } } #//#config-balancing-pool3 + +#//#config-balancing-pool4 +akka.actor.deployment { + /parent/router10c { + router = balancing-pool + nr-of-instances = 5 + pool-dispatcher { + mailbox = myapp.myprioritymailbox + } + } +} +#//#config-balancing-pool4 #//#config-smallest-mailbox-pool akka.actor.deployment { diff --git a/akka-docs/rst/scala/routing.rst b/akka-docs/rst/scala/routing.rst index 6456209388..5e8b5bb023 100644 --- a/akka-docs/rst/scala/routing.rst +++ b/akka-docs/rst/scala/routing.rst @@ -312,6 +312,20 @@ with a ``thread-pool-executor`` hinting the number of allocated threads explicit .. includecode:: code/docs/routing/RouterDocSpec.scala#config-balancing-pool3 +It is also possible to change the ``mailbox`` used by the balancing dispatcher for +scenarios where the default unbounded mailbox is not well suited. An example of such +a scenario could arise whether there exists the need to manage priority for each message. +You can then implement a priority mailbox and configure your dispatcher: + +.. includecode:: code/docs/routing/RouterDocSpec.scala#config-balancing-pool4 + +.. note:: + + Bear in mind that ``BalancingDispatcher`` requires a message queue that must be thread-safe for + multiple concurrent consumers. So it is mandatory for the message queue backing a custom mailbox + for this kind of dispatcher to implement akka.dispatch.MultipleConsumerSemantics. See details + on how to implement your custom mailbox in :ref:`mailboxes-scala`. + There is no Group variant of the BalancingPool. SmallestMailboxPool