@iLoveZod13 wrote:
Hi there,
I am trying to create resizable pool router with Akka Typed API. But it seems that new Typed router API does not support resizable pool.
Does this mean I will have to create resizable pool router with classic API and use it inside my typed Akka codes?
I tried with below:
import akka.actor.typed.scaladsl.adapter._ //Adapter to mix classic API with typed one object Worker { sealed trait Command case class DoLog(text: String) extends Command def apply(): Behavior[Command] = Behaviors.setup { context => context.log.info("Starting worker") Behaviors.receiveMessage { case DoLog(text) => context.log.info("{} got message {}",context.self , text) Behaviors.same } } } object MainController { def apply(): Behavior[NotUsed] = { Behaviors.setup[NotUsed]{ context => { //val config = ConfigFactory.load() val router: classic.ActorRef = context.actorOf( FromConfig.props(classic.Props[Worker]), "worker-pool-router") (0 to 10).foreach { n => router ! Worker.DoLog(s"msg $n") } Behaviors.same } } } }
I got compiling error with “FromConfig.props(classic.Props[Worker])”. Because in classic API, Props[XX] => here XX is expected to be an Actor class instead of an object.
Maybe this is a stupid question since I am a totally newbie to both scala and akka.
Any tips will be appreicated
Posts: 1
Participants: 1