On Mon, 2015-11-16 at 14:57 +0100, Patrik Nordwall wrote: > I think you can randomly delay start of the entity actors by using a > supervisor actor (similar to the BackoffSupervisor). By the way, I > will fix the passivation issue in the BackoffSupervisor.
Thanks for the answer! That's more or less what I want to do. I've seen the fix in the BackoffSupervisor, unfortunately I don't think it can work in the context of Cluster Sharding Passivation: 1) The entity (protected by a BackoffSupervisor) needs to stop 2) it sends a Passivate message to its parent BackoffSupervisor 3) the parent BackoffSupervisor forwards it to the Shard 4) Shard sees the sender() as the real entity (not the BackoffSupervisor) and executes this: https://github.com/akka/akka/blob/master/akka-cluster-sharding/src/main/scala/akka/cluster/sharding/Shard.scala#L155 5) which in turn ends in: https://github.com/akka/akka/blob/master/akka-cluster-sharding/src/main/scala/akka/cluster/sharding/Shard.scala#L209 def passivate(entity: ActorRef, stopMessage: Any): Unit = { idByRef.get(entity) match { case Some(id) if !messageBuffers.contains(id) ⇒ log.debug("Passivating started on entity {}", id) passivating = passivating + entity messageBuffers = messageBuffers.updated(id, Vector.empty) entity ! stopMessage case _ ⇒ //ignored } } The forwarded sender() can't be in the idByRef Map, since it's not the direct child of the Shard but the child of the BackoffSupervisor, so passivation is not started. The other issue, if this one has been solved is that the real entity receiving the passivation return message will have to stop itself, but also stop its ancestor (the BackoffSupervisor) otherwise this one will restart it. It really looks like we need a specific Cluster Sharding backoff supervisor that knows how passivation works. Anyway, thanks for all your work! -- Brice Figureau <[email protected]> -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
