I have tried this example but think that I misunderstand both the example and the documentation. I have tried to adapt the example but get:
Message [concurrency.StatsWorker$Available] to Actor[akka://WorkStealSystem/user/WorkerRouter#530679135] was dropped. No routees in group router for [ServiceKey[concurrency.StatsWorker$Command](StatsService)]. [1] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
My question is: do I need to use Routers.pool()
to add routees to the group router or is their some other way to do this? I have the following:
val groupRouter: GroupRouter[StatsWorker.Command] = Routers.group(App.StatsServiceKey)
val serviceRouter: ActorRef[StatsWorker.Command] = ctx.spawn( groupRouter, "WorkerRouter")
val worker = StatsWorker(serviceRouter)
val service = ctx.spawn(worker, "WorkerService")
// published through the receptionist to the other nodes in the cluster
ctx.system.receptionist ! Receptionist.Register(StatsServiceKey, service)
And in the StatsWorker
I have:
def apply(serviceRouter: ActorRef[StatsWorker.Command]): Behavior[Command] =
Behaviors.setup { ctx =>
ctx.log.info("Worker starting up")
ctx.log.info("Sending available")
serviceRouter ! Available(ctx.self)
ctx.log.info("Waiting for job")
waitJob(ctx)
}
which results on the above log message.
My objective is to have a set of actors register themselves so that they be contacted by another set of actors. More concretely can I assume that if I use:
val groupRouter: GroupRouter[StatsWorker.Command] = Routers.group(App.StatsServiceKey)
val serviceRouter: ActorRef[StatsWorker.Command] = ctx.spawn( groupRouter, "WorkerRouter")
val worker = AnotherWorker(serviceRouter)
val service = ctx.spawn(worker, "WorkerService")
the AnotherWorker
actor can send messages to the group?
My apologies if I am completely off the mark, but I am a beginner.
TIA
1 post - 1 participant