From 3c2d712af28a6875e149124401e554161b937d95 Mon Sep 17 00:00:00 2001 From: "Andy.Chen" Date: Sat, 3 Feb 2024 17:06:58 +0800 Subject: [PATCH 01/13] additional mailbox selector for typed props --- .../main/scala/org/apache/pekko/actor/typed/Props.scala | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/Props.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/Props.scala index afc2ece0b35..45aa6d8b51a 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/Props.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/Props.scala @@ -81,6 +81,13 @@ abstract class Props private[pekko] () extends Product with Serializable { */ def withDispatcherFromConfig(path: String): Props = DispatcherFromConfig(path, this) + /** + * Prepend a selection of the mailbox found at the given Config path to this Props. + * The path is relative to the configuration root of the [[ActorSystem]] that looks up the + * mailbox. + */ + def withMailboxFromConfig(path: String): Props = MailboxFromConfigSelector(path, this) + /** * Prepend a selection of the same executor as the parent actor to this Props. */ From 7144f063f8109821e53ab4845d8097744ae1f4e5 Mon Sep 17 00:00:00 2001 From: "Andy.Chen" Date: Mon, 5 Feb 2024 19:48:35 +0800 Subject: [PATCH 02/13] add unit test --- .../scaladsl/DispatcherSelectorSpec.scala | 46 ++++--- .../typed/scaladsl/MailboxSelectorSpec.scala | 130 ++++++++++++++++++ 2 files changed, 156 insertions(+), 20 deletions(-) create mode 100644 actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/MailboxSelectorSpec.scala diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/DispatcherSelectorSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/DispatcherSelectorSpec.scala index c1ce21cc991..b331ecfa778 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/DispatcherSelectorSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/DispatcherSelectorSpec.scala @@ -16,8 +16,9 @@ package org.apache.pekko.actor.typed.scaladsl import com.typesafe.config.Config import com.typesafe.config.ConfigFactory import org.scalatest.wordspec.AnyWordSpecLike - import org.apache.pekko +import org.apache.pekko.actor.typed.DispatcherSelector +import org.apache.pekko.actor.typed.scaladsl.AskPattern._ import pekko.actor.BootstrapSetup import pekko.actor.setup.ActorSystemSetup import pekko.actor.testkit.typed.scaladsl.ActorTestKit @@ -28,11 +29,11 @@ import pekko.actor.testkit.typed.scaladsl.TestProbe import pekko.actor.typed.ActorRef import pekko.actor.typed.ActorSystem import pekko.actor.typed.Behavior -import pekko.actor.typed.Props import pekko.actor.typed.SpawnProtocol object DispatcherSelectorSpec { - val config = ConfigFactory.parseString(""" + val config = ConfigFactory.parseString( + """ ping-pong-dispatcher { executor = thread-pool-executor type = PinnedDispatcher @@ -41,6 +42,7 @@ object DispatcherSelectorSpec { object PingPong { case class Ping(replyTo: ActorRef[Pong]) + case class Pong(threadName: String) def apply(): Behavior[Ping] = @@ -57,6 +59,7 @@ class DispatcherSelectorSpec(config: Config) extends ScalaTestWithActorTestKit(config) with AnyWordSpecLike with LogCapturing { + import DispatcherSelectorSpec.PingPong import DispatcherSelectorSpec.PingPong._ @@ -64,9 +67,18 @@ class DispatcherSelectorSpec(config: Config) "DispatcherSelector" must { - "select dispatcher from config" in { + "select dispatcher from empty Props" in { val probe = createTestProbe[Pong]() - val pingPong = spawn(PingPong(), Props.empty.withDispatcherFromConfig("ping-pong-dispatcher")) + val pingPong = spawn(PingPong(), DispatcherSelector.fromConfig("ping-pong-dispatcher")) + pingPong ! Ping(probe.ref) + + val response = probe.receiveMessage() + response.threadName should startWith("DispatcherSelectorSpec-ping-pong-dispatcher") + } + + "select dispatcher from DispatcherSelector" in { + val probe = createTestProbe[Pong]() + val pingPong = spawn(PingPong(), DispatcherSelector.fromConfig("ping-pong-dispatcher")) pingPong ! Ping(probe.ref) val response = probe.receiveMessage() @@ -76,15 +88,15 @@ class DispatcherSelectorSpec(config: Config) "detect unknown dispatcher from config" in { val probe = createTestProbe[Pong]() LoggingTestKit.error("Spawn failed").expect { - val ref = spawn(PingPong(), Props.empty.withDispatcherFromConfig("unknown")) + val ref = spawn(PingPong(), DispatcherSelector.fromConfig("unknown")) probe.expectTerminated(ref) } } "select same dispatcher as parent" in { - val parent = spawn(SpawnProtocol(), Props.empty.withDispatcherFromConfig("ping-pong-dispatcher")) + val parent = spawn(SpawnProtocol(), DispatcherSelector.fromConfig("ping-pong-dispatcher")) val childProbe = createTestProbe[ActorRef[Ping]]() - parent ! SpawnProtocol.Spawn(PingPong(), "child", Props.empty.withDispatcherSameAsParent, childProbe.ref) + parent ! SpawnProtocol.Spawn(PingPong(), "child", DispatcherSelector.sameAsParent(), childProbe.ref) val probe = createTestProbe[Pong]() val child = childProbe.receiveMessage() @@ -95,19 +107,13 @@ class DispatcherSelectorSpec(config: Config) } "select same dispatcher as parent, several levels" in { - val grandParent = spawn(SpawnProtocol(), Props.empty.withDispatcherFromConfig("ping-pong-dispatcher")) - val parentProbe = createTestProbe[ActorRef[SpawnProtocol.Spawn[Ping]]]() - grandParent ! SpawnProtocol.Spawn( - SpawnProtocol(), - "parent", - Props.empty.withDispatcherSameAsParent, - parentProbe.ref) - - val childProbe = createTestProbe[ActorRef[Ping]]() - grandParent ! SpawnProtocol.Spawn(PingPong(), "child", Props.empty.withDispatcherSameAsParent, childProbe.ref) + val guardian = spawn(SpawnProtocol(), DispatcherSelector.fromConfig("ping-pong-dispatcher")) + val parent: ActorRef[SpawnProtocol.Command] = guardian.ask((replyTo: ActorRef[ActorRef[SpawnProtocol.Command]]) => + SpawnProtocol.Spawn(SpawnProtocol(), "parent", DispatcherSelector.sameAsParent(), replyTo)).futureValue + val child: ActorRef[Ping] = parent.ask((reply: ActorRef[ActorRef[Ping]]) => + SpawnProtocol.Spawn(PingPong(), "child", DispatcherSelector.sameAsParent(), reply)).futureValue val probe = createTestProbe[Pong]() - val child = childProbe.receiveMessage() child ! Ping(probe.ref) val response = probe.receiveMessage() @@ -119,7 +125,7 @@ class DispatcherSelectorSpec(config: Config) PingPong(), "DispatcherSelectorSpec2", ActorSystemSetup.create(BootstrapSetup()), - Props.empty.withDispatcherSameAsParent) + DispatcherSelector.sameAsParent()) try { val probe = TestProbe[Pong]()(sys) sys ! Ping(probe.ref) diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/MailboxSelectorSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/MailboxSelectorSpec.scala new file mode 100644 index 00000000000..37719276c68 --- /dev/null +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/MailboxSelectorSpec.scala @@ -0,0 +1,130 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.pekko.actor.typed.scaladsl + +import com.typesafe.config.Config +import com.typesafe.config.ConfigFactory +import org.apache.pekko.actor.ActorCell +import org.apache.pekko.actor.testkit.typed.scaladsl.LogCapturing +import org.apache.pekko.actor.testkit.typed.scaladsl.ScalaTestWithActorTestKit +import org.apache.pekko.actor.typed.ActorRef +import org.apache.pekko.actor.typed.Behavior +import org.apache.pekko.actor.typed.DispatcherSelector +import org.apache.pekko.actor.typed.MailboxSelector +import org.apache.pekko.actor.typed.Props +import org.apache.pekko.actor.typed.internal.adapter.ActorContextAdapter +import org.apache.pekko.actor.typed.scaladsl.AskPattern._ +import org.apache.pekko.dispatch.BoundedMessageQueueSemantics +import org.apache.pekko.dispatch.BoundedNodeMessageQueue +import org.apache.pekko.dispatch.Dispatchers +import org.apache.pekko.dispatch.MessageQueue +import org.apache.pekko.dispatch.NodeMessageQueue +import org.scalatest.wordspec.AnyWordSpecLike + +object MailboxSelectorSpec { + val config = ConfigFactory.parseString( + """ + specific-mailbox { + mailbox-type = "org.apache.pekko.dispatch.NonBlockingBoundedMailbox" + mailbox-capacity = 4 + } + """) + + object PingPong { + case class Ping(replyTo: ActorRef[Pong]) + + case class Pong(threadName: String) + + def apply(): Behavior[Ping] = + Behaviors.receiveMessage[Ping] { message => + message.replyTo ! Pong(Thread.currentThread().getName) + Behaviors.same + } + + } + +} + +class MailboxSelectorSpec(config: Config) + extends ScalaTestWithActorTestKit(config) + with AnyWordSpecLike + with LogCapturing { + + def this() = this(MailboxSelectorSpec.config) + + sealed trait Command + case class WhatsYourMailbox(replyTo: ActorRef[MessageQueue]) extends Command + case class WhatsYourDispatcher(replyTo: ActorRef[String]) extends Command + + private def extract[R](context: ActorContext[_], f: ActorCell => R): R = { + context match { + case adapter: ActorContextAdapter[_] => + adapter.classicActorContext match { + case cell: ActorCell => f(cell) + case unexpected => throw new RuntimeException(s"Unexpected: $unexpected") + } + case unexpected => throw new RuntimeException(s"Unexpected: $unexpected") + } + } + + private def behavior: Behavior[Command] = + Behaviors.setup { context => + Behaviors.receiveMessage[Command] { + case WhatsYourMailbox(replyTo) => + replyTo ! extract(context, cell => cell.mailbox.messageQueue) + Behaviors.same + case WhatsYourDispatcher(replyTo) => + replyTo ! extract(context, cell => cell.dispatcher.id) + Behaviors.same + } + } + + "MailboxSelectorSpec" must { + + "default is unbounded" in { + val actor = spawn(behavior) + val mailbox = actor.ask(WhatsYourMailbox(_)).futureValue + mailbox shouldBe a[NodeMessageQueue] + } + + "select an specific mailbox from MailboxSelector " in { + val actor = spawn(behavior, MailboxSelector.fromConfig("specific-mailbox")) + val mailbox = actor.ask(WhatsYourMailbox(_)).futureValue + mailbox shouldBe a[BoundedMessageQueueSemantics] + mailbox.asInstanceOf[BoundedNodeMessageQueue].capacity should ===(4) + } + + "select an specific mailbox from empty Props " in { + val actor = spawn(behavior, Props.empty.withMailboxFromConfig("specific-mailbox")) + val mailbox = actor.ask(WhatsYourMailbox(_)).futureValue + mailbox shouldBe a[BoundedMessageQueueSemantics] + mailbox.asInstanceOf[BoundedNodeMessageQueue].capacity should ===(4) + } + + "select an specific mailbox from DispatcherSelector " in { + val actor = spawn(behavior, DispatcherSelector.blocking().withMailboxFromConfig("specific-mailbox")) + val mailbox = actor.ask(WhatsYourMailbox(_)).futureValue + mailbox shouldBe a[BoundedMessageQueueSemantics] + mailbox.asInstanceOf[BoundedNodeMessageQueue].capacity should ===(4) + val dispatcher = actor.ask(WhatsYourDispatcher(_)).futureValue + dispatcher shouldBe Dispatchers.DefaultBlockingDispatcherId + } + + } + +} From 1fb604508f16667801d6e8230240fac179700564 Mon Sep 17 00:00:00 2001 From: "Andy.Chen" Date: Mon, 5 Feb 2024 19:51:45 +0800 Subject: [PATCH 03/13] chore change of unit test --- .../actor/typed/scaladsl/DispatcherSelectorSpec.scala | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/DispatcherSelectorSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/DispatcherSelectorSpec.scala index b331ecfa778..949158e3eb5 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/DispatcherSelectorSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/DispatcherSelectorSpec.scala @@ -18,6 +18,7 @@ import com.typesafe.config.ConfigFactory import org.scalatest.wordspec.AnyWordSpecLike import org.apache.pekko import org.apache.pekko.actor.typed.DispatcherSelector +import org.apache.pekko.actor.typed.Props import org.apache.pekko.actor.typed.scaladsl.AskPattern._ import pekko.actor.BootstrapSetup import pekko.actor.setup.ActorSystemSetup @@ -32,8 +33,7 @@ import pekko.actor.typed.Behavior import pekko.actor.typed.SpawnProtocol object DispatcherSelectorSpec { - val config = ConfigFactory.parseString( - """ + val config = ConfigFactory.parseString(""" ping-pong-dispatcher { executor = thread-pool-executor type = PinnedDispatcher @@ -42,7 +42,6 @@ object DispatcherSelectorSpec { object PingPong { case class Ping(replyTo: ActorRef[Pong]) - case class Pong(threadName: String) def apply(): Behavior[Ping] = @@ -59,7 +58,6 @@ class DispatcherSelectorSpec(config: Config) extends ScalaTestWithActorTestKit(config) with AnyWordSpecLike with LogCapturing { - import DispatcherSelectorSpec.PingPong import DispatcherSelectorSpec.PingPong._ @@ -69,7 +67,7 @@ class DispatcherSelectorSpec(config: Config) "select dispatcher from empty Props" in { val probe = createTestProbe[Pong]() - val pingPong = spawn(PingPong(), DispatcherSelector.fromConfig("ping-pong-dispatcher")) + val pingPong = spawn(PingPong(), Props.empty.withDispatcherFromConfig("ping-pong-dispatcher")) pingPong ! Ping(probe.ref) val response = probe.receiveMessage() From ffd4af084d7b87ca2f0716fa6cb7d8105863998f Mon Sep 17 00:00:00 2001 From: "Andy.Chen" Date: Mon, 5 Feb 2024 20:59:25 +0800 Subject: [PATCH 04/13] Revert "configuration typo" This reverts commit 7917feb32a4b042124513d98068db832cc59a541. --- actor-typed/src/main/resources/reference.conf | 4 ++-- actor/src/main/resources/reference.conf | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/actor-typed/src/main/resources/reference.conf b/actor-typed/src/main/resources/reference.conf index 208c6894971..d564d6070b8 100644 --- a/actor-typed/src/main/resources/reference.conf +++ b/actor-typed/src/main/resources/reference.conf @@ -26,7 +26,7 @@ pekko.actor.typed { # buffer. If the capacity is exceed then additional incoming messages are dropped. restart-stash-capacity = 1000 - # Typed mailbox defaults to the single consumer mailbox as balancing dispatcher is not supported + # Typed mailbox defaults to the single consumber mailbox as balancing dispatcher is not supported default-mailbox { mailbox-type = "org.apache.pekko.dispatch.SingleConsumerOnlyUnboundedMailbox" } @@ -73,7 +73,7 @@ pekko.reliable-delivery { # To avoid head of line blocking from serialization and transfer # of large messages this can be enabled. # Large messages are chunked into pieces of the given size in bytes. The - # chunked messages are sent separately and assembled on the consumer side. + # chunked messages are sent separatetely and assembled on the consumer side. # Serialization and deserialization is performed by the ProducerController and # ConsumerController respectively instead of in the remote transport layer. chunk-large-messages = off diff --git a/actor/src/main/resources/reference.conf b/actor/src/main/resources/reference.conf index c7febd24584..b83a5e5aa71 100644 --- a/actor/src/main/resources/reference.conf +++ b/actor/src/main/resources/reference.conf @@ -323,8 +323,8 @@ pekko { # Probability of doing an exploration v.s. optimization. chance-of-exploration = 0.4 - # When downsizing after a long streak of under-utilization, the resizer - # will downsize the pool to the highest utilization multiplied by a + # When downsizing after a long streak of underutilization, the resizer + # will downsize the pool to the highest utiliziation multiplied by a # a downsize ratio. This downsize ratio determines the new pools size # in comparison to the highest utilization. # E.g. if the highest utilization is 10, and the down size ratio @@ -1349,7 +1349,7 @@ pekko { # In order to skip this additional delay set as 0 random-factor = 0.0 - # A allow-list of fqcn of Exceptions that the CircuitBreaker + # A allowlist of fqcn of Exceptions that the CircuitBreaker # should not consider failures. By default all exceptions are # considered failures. exception-allowlist = [] From 40ad4f04305a02ab02d5539844340b61c116d7ea Mon Sep 17 00:00:00 2001 From: "Andy.Chen" Date: Mon, 5 Feb 2024 21:15:44 +0800 Subject: [PATCH 05/13] fix pekko imports --- .../scaladsl/DispatcherSelectorSpec.scala | 6 ++-- .../typed/scaladsl/MailboxSelectorSpec.scala | 31 ++++++++++--------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/DispatcherSelectorSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/DispatcherSelectorSpec.scala index 949158e3eb5..f5770a592f8 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/DispatcherSelectorSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/DispatcherSelectorSpec.scala @@ -17,9 +17,9 @@ import com.typesafe.config.Config import com.typesafe.config.ConfigFactory import org.scalatest.wordspec.AnyWordSpecLike import org.apache.pekko -import org.apache.pekko.actor.typed.DispatcherSelector -import org.apache.pekko.actor.typed.Props -import org.apache.pekko.actor.typed.scaladsl.AskPattern._ +import pekko.actor.typed.DispatcherSelector +import pekko.actor.typed.Props +import pekko.actor.typed.scaladsl.AskPattern._ import pekko.actor.BootstrapSetup import pekko.actor.setup.ActorSystemSetup import pekko.actor.testkit.typed.scaladsl.ActorTestKit diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/MailboxSelectorSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/MailboxSelectorSpec.scala index 37719276c68..57f1f207a54 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/MailboxSelectorSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/MailboxSelectorSpec.scala @@ -19,21 +19,22 @@ package org.apache.pekko.actor.typed.scaladsl import com.typesafe.config.Config import com.typesafe.config.ConfigFactory -import org.apache.pekko.actor.ActorCell -import org.apache.pekko.actor.testkit.typed.scaladsl.LogCapturing -import org.apache.pekko.actor.testkit.typed.scaladsl.ScalaTestWithActorTestKit -import org.apache.pekko.actor.typed.ActorRef -import org.apache.pekko.actor.typed.Behavior -import org.apache.pekko.actor.typed.DispatcherSelector -import org.apache.pekko.actor.typed.MailboxSelector -import org.apache.pekko.actor.typed.Props -import org.apache.pekko.actor.typed.internal.adapter.ActorContextAdapter -import org.apache.pekko.actor.typed.scaladsl.AskPattern._ -import org.apache.pekko.dispatch.BoundedMessageQueueSemantics -import org.apache.pekko.dispatch.BoundedNodeMessageQueue -import org.apache.pekko.dispatch.Dispatchers -import org.apache.pekko.dispatch.MessageQueue -import org.apache.pekko.dispatch.NodeMessageQueue +import org.apache.pekko +import pekko.actor.ActorCell +import pekko.actor.testkit.typed.scaladsl.LogCapturing +import pekko.actor.testkit.typed.scaladsl.ScalaTestWithActorTestKit +import pekko.actor.typed.ActorRef +import pekko.actor.typed.Behavior +import pekko.actor.typed.DispatcherSelector +import pekko.actor.typed.MailboxSelector +import pekko.actor.typed.Props +import pekko.actor.typed.internal.adapter.ActorContextAdapter +import pekko.actor.typed.scaladsl.AskPattern._ +import pekko.dispatch.BoundedMessageQueueSemantics +import pekko.dispatch.BoundedNodeMessageQueue +import pekko.dispatch.Dispatchers +import pekko.dispatch.MessageQueue +import pekko.dispatch.NodeMessageQueue import org.scalatest.wordspec.AnyWordSpecLike object MailboxSelectorSpec { From 8e3f60314fca153a8659db0527d51c0ed9ace553 Mon Sep 17 00:00:00 2001 From: "Andy.Chen" Date: Tue, 6 Feb 2024 13:54:31 +0800 Subject: [PATCH 06/13] mention interoperability in doc --- .../pekko/typed/DispatchersDocTest.java | 22 ++++++++++++++ .../apache/pekko/typed/MailboxDocTest.java | 29 +++++++++++++++++++ .../pekko/typed/DispatchersDocSpec.scala | 18 ++++++++++++ .../apache/pekko/typed/MailboxDocSpec.scala | 22 ++++++++++++++ docs/src/main/paradox/typed/dispatchers.md | 13 ++++++++- docs/src/main/paradox/typed/mailboxes.md | 11 +++++++ 6 files changed, 114 insertions(+), 1 deletion(-) diff --git a/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/DispatchersDocTest.java b/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/DispatchersDocTest.java index 183f697eda1..55be76b120f 100644 --- a/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/DispatchersDocTest.java +++ b/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/DispatchersDocTest.java @@ -29,4 +29,26 @@ public static void spawnDispatchers(ActorContext context, Behavior context, Behavior behavior) { + // #interoperability-with-mailbox + context.spawn( + behavior, + "ExplicitDefaultDispatcher", + DispatcherSelector.defaultDispatcher().withMailboxFromConfig("your-mailbox")); + context.spawn( + behavior, + "BlockingDispatcher", + DispatcherSelector.blocking().withMailboxFromConfig("your-mailbox")); + context.spawn( + behavior, + "ParentDispatcher", + DispatcherSelector.sameAsParent().withMailboxFromConfig("your-mailbox")); + context.spawn( + behavior, + "DispatcherFromConfig", + DispatcherSelector.fromConfig("your-dispatcher").withMailboxFromConfig("your-mailbox")); + // #interoperability-with-mailbox + } } diff --git a/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/MailboxDocTest.java b/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/MailboxDocTest.java index c0486f57d8c..28eca5d8732 100644 --- a/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/MailboxDocTest.java +++ b/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/MailboxDocTest.java @@ -59,4 +59,33 @@ public void startSomeActorsWithDifferentMailboxes() { ActorRef ref = testKit.spawn(setup); testProbe.receiveMessage(); } + + @Test + public void startSomeActorsWithMailboxSelectorInteroperability() { + TestProbe testProbe = testKit.createTestProbe(); + Behavior childBehavior = Behaviors.empty(); + + Behavior setup = + Behaviors.setup( + context -> { + // #interoperability-with-dispatcher + context.spawn( + childBehavior, + "bounded-mailbox-child", + MailboxSelector.bounded(100).withDispatcherDefault()); + + context.spawn( + childBehavior, + "from-config-mailbox-child", + MailboxSelector.fromConfig("my-app.my-special-mailbox") + .withMailboxFromConfig("custom-dispatcher")); + // #interoperability-with-dispatcher + + testProbe.ref().tell(Done.getInstance()); + return Behaviors.stopped(); + }); + + ActorRef ref = testKit.spawn(setup); + testProbe.receiveMessage(); + } } diff --git a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/DispatchersDocSpec.scala b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/DispatchersDocSpec.scala index 54753d6f8de..77acfd86bc9 100644 --- a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/DispatchersDocSpec.scala +++ b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/DispatchersDocSpec.scala @@ -65,6 +65,24 @@ object DispatchersDocSpec { Behaviors.same } + val interoperableExample = Behaviors.receive[Any] { (context, _) => + // #interoperability-with-mailbox + import org.apache.pekko.actor.typed.DispatcherSelector + + context.spawn(yourBehavior, "DefaultDispatcher") + context.spawn(yourBehavior, "ExplicitDefaultDispatcher", + DispatcherSelector.default().withMailboxFromConfig("your-mailbox")) + context.spawn(yourBehavior, "BlockingDispatcher", + DispatcherSelector.blocking().withMailboxFromConfig("your-mailbox")) + context.spawn(yourBehavior, "ParentDispatcher", + DispatcherSelector.sameAsParent().withMailboxFromConfig("your-mailbox")) + context.spawn(yourBehavior, "DispatcherFromConfig", + DispatcherSelector.fromConfig("your-dispatcher").withMailboxFromConfig("your-mailbox")) + // #interoperability-with-mailbox + + Behaviors.same + } + } class DispatchersDocSpec diff --git a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/MailboxDocSpec.scala b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/MailboxDocSpec.scala index 1d24535dab9..2ea7ff5b9dd 100644 --- a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/MailboxDocSpec.scala +++ b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/MailboxDocSpec.scala @@ -47,6 +47,28 @@ class MailboxDocSpec probe.receiveMessage() } + + "interoperability with DispatcherSelector" in { + + val probe = createTestProbe[Done]() + val childBehavior: Behavior[String] = Behaviors.empty + val parent: Behavior[Unit] = Behaviors.setup { context => + // #interoperability-with-dispatcher + context.spawn(childBehavior, "bounded-mailbox-child", MailboxSelector.bounded(100).withDispatcherDefault) + + val props = + MailboxSelector.fromConfig("my-app.my-special-mailbox").withDispatcherFromConfig("custom-dispatcher") + context.spawn(childBehavior, "from-config-mailbox-child", props) + // #interoperability-with-dispatcher + + probe.ref ! Done + Behaviors.stopped + } + spawn(parent) + + probe.receiveMessage() + + } } } diff --git a/docs/src/main/paradox/typed/dispatchers.md b/docs/src/main/paradox/typed/dispatchers.md index c98be3a043e..2347dc73001 100644 --- a/docs/src/main/paradox/typed/dispatchers.md +++ b/docs/src/main/paradox/typed/dispatchers.md @@ -55,7 +55,7 @@ A default dispatcher is used for all actors that are spawned without specifying This is suitable for all actors that don't block. Blocking in actors needs to be carefully managed, more details @ref:[here](#blocking-needs-careful-management). -To select a dispatcher use `DispatcherSelector` to create a `Props` instance for spawning your actor: +To select a dispatcher use @apidoc[DispatcherSelector](DispatcherSelector$) to create a @apidoc[Props](typed.Props) instance for spawning your actor: Scala : @@snip [DispatcherDocSpec.scala](/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/DispatchersDocSpec.scala) { #spawn-dispatcher } @@ -74,6 +74,17 @@ The final example shows how to load a custom dispatcher from configuration and r @@snip [DispatcherDocSpec.scala](/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/DispatchersDocSpec.scala) { #config } +### Interoperability with MailboxSelector + +The @apidoc[DispatcherSelector](DispatcherSelector$) will create a @apidoc[Props](typed.Props) instance that can be both set up Dispatcher and Mailbox, +which means that you can continue to set up Mailbox through chain calls. + +Scala +: @@snip [DispatcherDocSpec.scala](/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/DispatchersDocSpec.scala) { #interoperability-with-mailbox } + +Java +: @@snip [DispatcherDocTest.java](/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/DispatchersDocTest.java) { #interoperability-with-mailbox } + ## Types of dispatchers There are 2 different types of message dispatchers: diff --git a/docs/src/main/paradox/typed/mailboxes.md b/docs/src/main/paradox/typed/mailboxes.md index e2ed3e8b0c9..5c73293ae5a 100644 --- a/docs/src/main/paradox/typed/mailboxes.md +++ b/docs/src/main/paradox/typed/mailboxes.md @@ -58,6 +58,17 @@ configuration section from the @apidoc[ActorSystem](typed.ActorSystem) configura `id` key with the configuration path of the mailbox type and adding a fall-back to the default mailbox configuration section. +### Interoperability with DispatcherSelector + +The @apidoc[MailboxSelector](MailboxSelector$) will create a @apidoc[Props](typed.Props) instance that can be both set up Dispatcher and Mailbox, +which means that you can continue to set up Dispatcher through chain calls. + +Scala +: @@snip [MailboxDocSpec.scala](/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/MailboxDocSpec.scala) { #interoperability-with-dispatcher } + +Java +: @@snip [MailboxDocTest.java](/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/MailboxDocTest.java) { #interoperability-with-dispatcher } + ## Mailbox Implementations Pekko ships with a number of mailbox implementations: From d20e39a10381e247cff176246da7f81c6ee38138 Mon Sep 17 00:00:00 2001 From: "Andy.Chen" Date: Tue, 6 Feb 2024 14:55:30 +0800 Subject: [PATCH 07/13] share configuration in tests --- .../org/apache/pekko/typed/DispatchersDocTest.java | 9 +++++---- .../jdocs/org/apache/pekko/typed/MailboxDocTest.java | 2 +- .../org/apache/pekko/typed/DispatchersDocSpec.scala | 11 ++++++----- .../docs/org/apache/pekko/typed/MailboxDocSpec.scala | 5 +++-- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/DispatchersDocTest.java b/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/DispatchersDocTest.java index 55be76b120f..df8b6728102 100644 --- a/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/DispatchersDocTest.java +++ b/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/DispatchersDocTest.java @@ -36,19 +36,20 @@ public static void spawnDispatchersWithInteroperability( context.spawn( behavior, "ExplicitDefaultDispatcher", - DispatcherSelector.defaultDispatcher().withMailboxFromConfig("your-mailbox")); + DispatcherSelector.defaultDispatcher().withMailboxFromConfig("my-app.my-special-mailbox")); context.spawn( behavior, "BlockingDispatcher", - DispatcherSelector.blocking().withMailboxFromConfig("your-mailbox")); + DispatcherSelector.blocking().withMailboxFromConfig("my-app.my-special-mailbox")); context.spawn( behavior, "ParentDispatcher", - DispatcherSelector.sameAsParent().withMailboxFromConfig("your-mailbox")); + DispatcherSelector.sameAsParent().withMailboxFromConfig("my-app.my-special-mailbox")); context.spawn( behavior, "DispatcherFromConfig", - DispatcherSelector.fromConfig("your-dispatcher").withMailboxFromConfig("your-mailbox")); + DispatcherSelector.fromConfig("your-dispatcher") + .withMailboxFromConfig("my-app.my-special-mailbox")); // #interoperability-with-mailbox } } diff --git a/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/MailboxDocTest.java b/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/MailboxDocTest.java index 28eca5d8732..28d0684f3aa 100644 --- a/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/MailboxDocTest.java +++ b/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/MailboxDocTest.java @@ -78,7 +78,7 @@ public void startSomeActorsWithMailboxSelectorInteroperability() { childBehavior, "from-config-mailbox-child", MailboxSelector.fromConfig("my-app.my-special-mailbox") - .withMailboxFromConfig("custom-dispatcher")); + .withMailboxFromConfig("your-dispatcher")); // #interoperability-with-dispatcher testProbe.ref().tell(Done.getInstance()); diff --git a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/DispatchersDocSpec.scala b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/DispatchersDocSpec.scala index 77acfd86bc9..67141690eb0 100644 --- a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/DispatchersDocSpec.scala +++ b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/DispatchersDocSpec.scala @@ -71,13 +71,13 @@ object DispatchersDocSpec { context.spawn(yourBehavior, "DefaultDispatcher") context.spawn(yourBehavior, "ExplicitDefaultDispatcher", - DispatcherSelector.default().withMailboxFromConfig("your-mailbox")) + DispatcherSelector.default().withMailboxFromConfig("my-app.my-special-mailbox")) context.spawn(yourBehavior, "BlockingDispatcher", - DispatcherSelector.blocking().withMailboxFromConfig("your-mailbox")) + DispatcherSelector.blocking().withMailboxFromConfig("my-app.my-special-mailbox")) context.spawn(yourBehavior, "ParentDispatcher", - DispatcherSelector.sameAsParent().withMailboxFromConfig("your-mailbox")) + DispatcherSelector.sameAsParent().withMailboxFromConfig("my-app.my-special-mailbox")) context.spawn(yourBehavior, "DispatcherFromConfig", - DispatcherSelector.fromConfig("your-dispatcher").withMailboxFromConfig("your-mailbox")) + DispatcherSelector.fromConfig("your-dispatcher").withMailboxFromConfig("my-app.my-special-mailbox")) // #interoperability-with-mailbox Behaviors.same @@ -86,7 +86,8 @@ object DispatchersDocSpec { } class DispatchersDocSpec - extends ScalaTestWithActorTestKit(DispatchersDocSpec.config) + extends ScalaTestWithActorTestKit( + DispatchersDocSpec.config.withFallback(ConfigFactory.load("mailbox-config-sample.conf"))) with AnyWordSpecLike with LogCapturing { diff --git a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/MailboxDocSpec.scala b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/MailboxDocSpec.scala index 2ea7ff5b9dd..935b72a057b 100644 --- a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/MailboxDocSpec.scala +++ b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/MailboxDocSpec.scala @@ -24,7 +24,8 @@ import com.typesafe.config.ConfigFactory import org.scalatest.wordspec.AnyWordSpecLike class MailboxDocSpec - extends ScalaTestWithActorTestKit(ConfigFactory.load("mailbox-config-sample.conf")) + extends ScalaTestWithActorTestKit( + ConfigFactory.load("mailbox-config-sample.conf").withFallback(DispatchersDocSpec.config)) with AnyWordSpecLike with LogCapturing { @@ -57,7 +58,7 @@ class MailboxDocSpec context.spawn(childBehavior, "bounded-mailbox-child", MailboxSelector.bounded(100).withDispatcherDefault) val props = - MailboxSelector.fromConfig("my-app.my-special-mailbox").withDispatcherFromConfig("custom-dispatcher") + MailboxSelector.fromConfig("my-app.my-special-mailbox").withDispatcherFromConfig("your-dispatcher") context.spawn(childBehavior, "from-config-mailbox-child", props) // #interoperability-with-dispatcher From b9b046d052f654f14562f71b2885a531aeb9b40b Mon Sep 17 00:00:00 2001 From: "Andy.Chen" Date: Tue, 6 Feb 2024 15:22:12 +0800 Subject: [PATCH 08/13] revert configuration change --- actor-typed/src/main/resources/reference.conf | 4 ++-- actor/src/main/resources/reference.conf | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/actor-typed/src/main/resources/reference.conf b/actor-typed/src/main/resources/reference.conf index d564d6070b8..208c6894971 100644 --- a/actor-typed/src/main/resources/reference.conf +++ b/actor-typed/src/main/resources/reference.conf @@ -26,7 +26,7 @@ pekko.actor.typed { # buffer. If the capacity is exceed then additional incoming messages are dropped. restart-stash-capacity = 1000 - # Typed mailbox defaults to the single consumber mailbox as balancing dispatcher is not supported + # Typed mailbox defaults to the single consumer mailbox as balancing dispatcher is not supported default-mailbox { mailbox-type = "org.apache.pekko.dispatch.SingleConsumerOnlyUnboundedMailbox" } @@ -73,7 +73,7 @@ pekko.reliable-delivery { # To avoid head of line blocking from serialization and transfer # of large messages this can be enabled. # Large messages are chunked into pieces of the given size in bytes. The - # chunked messages are sent separatetely and assembled on the consumer side. + # chunked messages are sent separately and assembled on the consumer side. # Serialization and deserialization is performed by the ProducerController and # ConsumerController respectively instead of in the remote transport layer. chunk-large-messages = off diff --git a/actor/src/main/resources/reference.conf b/actor/src/main/resources/reference.conf index b83a5e5aa71..c7febd24584 100644 --- a/actor/src/main/resources/reference.conf +++ b/actor/src/main/resources/reference.conf @@ -323,8 +323,8 @@ pekko { # Probability of doing an exploration v.s. optimization. chance-of-exploration = 0.4 - # When downsizing after a long streak of underutilization, the resizer - # will downsize the pool to the highest utiliziation multiplied by a + # When downsizing after a long streak of under-utilization, the resizer + # will downsize the pool to the highest utilization multiplied by a # a downsize ratio. This downsize ratio determines the new pools size # in comparison to the highest utilization. # E.g. if the highest utilization is 10, and the down size ratio @@ -1349,7 +1349,7 @@ pekko { # In order to skip this additional delay set as 0 random-factor = 0.0 - # A allowlist of fqcn of Exceptions that the CircuitBreaker + # A allow-list of fqcn of Exceptions that the CircuitBreaker # should not consider failures. By default all exceptions are # considered failures. exception-allowlist = [] From 160072c4377251f5b20d2279ebdad49507a7a627 Mon Sep 17 00:00:00 2001 From: "Andy.Chen" Date: Tue, 6 Feb 2024 15:25:42 +0800 Subject: [PATCH 09/13] fix new typo --- actor/src/main/resources/reference.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actor/src/main/resources/reference.conf b/actor/src/main/resources/reference.conf index c7febd24584..e603e58c437 100644 --- a/actor/src/main/resources/reference.conf +++ b/actor/src/main/resources/reference.conf @@ -324,7 +324,7 @@ pekko { chance-of-exploration = 0.4 # When downsizing after a long streak of under-utilization, the resizer - # will downsize the pool to the highest utilization multiplied by a + # will downsize the pool to the highest utilization multiplied by # a downsize ratio. This downsize ratio determines the new pools size # in comparison to the highest utilization. # E.g. if the highest utilization is 10, and the down size ratio From 9c1022f01fd120eb076632c0caa96f5b856457d3 Mon Sep 17 00:00:00 2001 From: "Andy.Chen" Date: Tue, 6 Feb 2024 16:23:48 +0800 Subject: [PATCH 10/13] fix jdocs tests --- .../org/apache/pekko/typed/MailboxDocTest.java | 3 ++- .../apache/pekko/typed/DispatchersDocSpec.scala | 14 ++++++++------ .../org/apache/pekko/typed/MailboxDocSpec.scala | 7 ++++--- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/MailboxDocTest.java b/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/MailboxDocTest.java index 28d0684f3aa..9d6b64c1e8e 100644 --- a/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/MailboxDocTest.java +++ b/actor-typed-tests/src/test/java/jdocs/org/apache/pekko/typed/MailboxDocTest.java @@ -19,6 +19,7 @@ import org.apache.pekko.actor.testkit.typed.javadsl.TestProbe; import org.apache.pekko.actor.typed.ActorRef; import org.apache.pekko.actor.typed.Behavior; +import org.apache.pekko.actor.typed.Dispatchers; import org.apache.pekko.actor.typed.MailboxSelector; import org.apache.pekko.actor.typed.javadsl.Behaviors; import com.typesafe.config.ConfigFactory; @@ -78,7 +79,7 @@ public void startSomeActorsWithMailboxSelectorInteroperability() { childBehavior, "from-config-mailbox-child", MailboxSelector.fromConfig("my-app.my-special-mailbox") - .withMailboxFromConfig("your-dispatcher")); + .withDispatcherFromConfig(Dispatchers.DefaultDispatcherId())); // #interoperability-with-dispatcher testProbe.ref().tell(Done.getInstance()); diff --git a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/DispatchersDocSpec.scala b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/DispatchersDocSpec.scala index 67141690eb0..c7dcdb1fbac 100644 --- a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/DispatchersDocSpec.scala +++ b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/DispatchersDocSpec.scala @@ -40,6 +40,9 @@ object DispatchersDocSpec { throughput = 1 } //#config + your-mailbox { + mailbox-type = "org.apache.pekko.dispatch.SingleConsumerOnlyUnboundedMailbox" + } """.stripMargin) case class WhichDispatcher(replyTo: ActorRef[Dispatcher]) @@ -71,13 +74,13 @@ object DispatchersDocSpec { context.spawn(yourBehavior, "DefaultDispatcher") context.spawn(yourBehavior, "ExplicitDefaultDispatcher", - DispatcherSelector.default().withMailboxFromConfig("my-app.my-special-mailbox")) + DispatcherSelector.default().withMailboxFromConfig("your-mailbox")) context.spawn(yourBehavior, "BlockingDispatcher", - DispatcherSelector.blocking().withMailboxFromConfig("my-app.my-special-mailbox")) + DispatcherSelector.blocking().withMailboxFromConfig("your-mailbox")) context.spawn(yourBehavior, "ParentDispatcher", - DispatcherSelector.sameAsParent().withMailboxFromConfig("my-app.my-special-mailbox")) + DispatcherSelector.sameAsParent().withMailboxFromConfig("your-mailbox")) context.spawn(yourBehavior, "DispatcherFromConfig", - DispatcherSelector.fromConfig("your-dispatcher").withMailboxFromConfig("my-app.my-special-mailbox")) + DispatcherSelector.fromConfig("your-dispatcher").withMailboxFromConfig("your-mailbox")) // #interoperability-with-mailbox Behaviors.same @@ -86,8 +89,7 @@ object DispatchersDocSpec { } class DispatchersDocSpec - extends ScalaTestWithActorTestKit( - DispatchersDocSpec.config.withFallback(ConfigFactory.load("mailbox-config-sample.conf"))) + extends ScalaTestWithActorTestKit(DispatchersDocSpec.config) with AnyWordSpecLike with LogCapturing { diff --git a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/MailboxDocSpec.scala b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/MailboxDocSpec.scala index 935b72a057b..fbfb55e0ad1 100644 --- a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/MailboxDocSpec.scala +++ b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/MailboxDocSpec.scala @@ -21,11 +21,11 @@ import pekko.actor.typed.Behavior import pekko.actor.typed.MailboxSelector import pekko.actor.typed.scaladsl.Behaviors import com.typesafe.config.ConfigFactory +import org.apache.pekko.actor.typed.Dispatchers import org.scalatest.wordspec.AnyWordSpecLike class MailboxDocSpec - extends ScalaTestWithActorTestKit( - ConfigFactory.load("mailbox-config-sample.conf").withFallback(DispatchersDocSpec.config)) + extends ScalaTestWithActorTestKit(ConfigFactory.load("mailbox-config-sample.conf")) with AnyWordSpecLike with LogCapturing { @@ -58,7 +58,8 @@ class MailboxDocSpec context.spawn(childBehavior, "bounded-mailbox-child", MailboxSelector.bounded(100).withDispatcherDefault) val props = - MailboxSelector.fromConfig("my-app.my-special-mailbox").withDispatcherFromConfig("your-dispatcher") + MailboxSelector.fromConfig("my-app.my-special-mailbox").withDispatcherFromConfig( + Dispatchers.DefaultDispatcherId) context.spawn(childBehavior, "from-config-mailbox-child", props) // #interoperability-with-dispatcher From d7cc377c876dc1587d157bdc97b2c9b1231d0496 Mon Sep 17 00:00:00 2001 From: "Andy.Chen" Date: Tue, 6 Feb 2024 17:59:09 +0800 Subject: [PATCH 11/13] optimized import --- .../test/scala/docs/org/apache/pekko/typed/MailboxDocSpec.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/MailboxDocSpec.scala b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/MailboxDocSpec.scala index fbfb55e0ad1..aecf77f4ba8 100644 --- a/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/MailboxDocSpec.scala +++ b/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/MailboxDocSpec.scala @@ -18,10 +18,10 @@ import pekko.Done import pekko.actor.testkit.typed.scaladsl.ScalaTestWithActorTestKit import pekko.actor.testkit.typed.scaladsl.LogCapturing import pekko.actor.typed.Behavior +import pekko.actor.typed.Dispatchers import pekko.actor.typed.MailboxSelector import pekko.actor.typed.scaladsl.Behaviors import com.typesafe.config.ConfigFactory -import org.apache.pekko.actor.typed.Dispatchers import org.scalatest.wordspec.AnyWordSpecLike class MailboxDocSpec From 3490fc62abc455459dbedf81ec816ada5c65611a Mon Sep 17 00:00:00 2001 From: "Andy.Chen" Date: Tue, 6 Feb 2024 18:06:17 +0800 Subject: [PATCH 12/13] mention api version in doc --- .../src/main/scala/org/apache/pekko/actor/typed/Props.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/Props.scala b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/Props.scala index 45aa6d8b51a..3c8a8d23f3c 100644 --- a/actor-typed/src/main/scala/org/apache/pekko/actor/typed/Props.scala +++ b/actor-typed/src/main/scala/org/apache/pekko/actor/typed/Props.scala @@ -85,6 +85,7 @@ abstract class Props private[pekko] () extends Product with Serializable { * Prepend a selection of the mailbox found at the given Config path to this Props. * The path is relative to the configuration root of the [[ActorSystem]] that looks up the * mailbox. + * @since 1.1.0 */ def withMailboxFromConfig(path: String): Props = MailboxFromConfigSelector(path, this) From 3084433c896871750c52906f188c9418d74e2746 Mon Sep 17 00:00:00 2001 From: "Andy.Chen" Date: Sat, 24 Aug 2024 03:52:32 +0800 Subject: [PATCH 13/13] resolve import issue --- .../actor/typed/scaladsl/DispatcherSelectorSpec.scala | 7 ++++--- .../pekko/actor/typed/scaladsl/MailboxSelectorSpec.scala | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/DispatcherSelectorSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/DispatcherSelectorSpec.scala index f5770a592f8..62dcd12c5e4 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/DispatcherSelectorSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/DispatcherSelectorSpec.scala @@ -16,10 +16,8 @@ package org.apache.pekko.actor.typed.scaladsl import com.typesafe.config.Config import com.typesafe.config.ConfigFactory import org.scalatest.wordspec.AnyWordSpecLike + import org.apache.pekko -import pekko.actor.typed.DispatcherSelector -import pekko.actor.typed.Props -import pekko.actor.typed.scaladsl.AskPattern._ import pekko.actor.BootstrapSetup import pekko.actor.setup.ActorSystemSetup import pekko.actor.testkit.typed.scaladsl.ActorTestKit @@ -30,6 +28,9 @@ import pekko.actor.testkit.typed.scaladsl.TestProbe import pekko.actor.typed.ActorRef import pekko.actor.typed.ActorSystem import pekko.actor.typed.Behavior +import pekko.actor.typed.DispatcherSelector +import pekko.actor.typed.Props +import pekko.actor.typed.scaladsl.AskPattern._ import pekko.actor.typed.SpawnProtocol object DispatcherSelectorSpec { diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/MailboxSelectorSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/MailboxSelectorSpec.scala index 57f1f207a54..0f9b6a42c7b 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/MailboxSelectorSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/scaladsl/MailboxSelectorSpec.scala @@ -19,6 +19,8 @@ package org.apache.pekko.actor.typed.scaladsl import com.typesafe.config.Config import com.typesafe.config.ConfigFactory +import org.scalatest.wordspec.AnyWordSpecLike + import org.apache.pekko import pekko.actor.ActorCell import pekko.actor.testkit.typed.scaladsl.LogCapturing @@ -35,7 +37,6 @@ import pekko.dispatch.BoundedNodeMessageQueue import pekko.dispatch.Dispatchers import pekko.dispatch.MessageQueue import pekko.dispatch.NodeMessageQueue -import org.scalatest.wordspec.AnyWordSpecLike object MailboxSelectorSpec { val config = ConfigFactory.parseString(