No, use Cluster Singleton
http://doc.akka.io/docs/akka/2.5/scala/cluster-singleton.html

/Patrik
mån 8 maj 2017 kl. 05:07 skrev AL <[email protected]>:

> I am starting to use AKKA cluster.
>
> I would like that a certain task will be performed by a single actor in
> the cluster. If that actor is down, it should be performed by other actor.
> I thought to accomplish that by tracking the LeaderChanged event and check
> if the current Actor is the leader. Something like
>
> case LeaderChanged => if ((cluster.state.leader.map(_ == 
> cluster.selfAddress).getOrElse(false))
>  //do some task
>
> is that the idiomatic way to do it ?
>
> --
> >>>>>>>>>> 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 https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
>>>>>>>>>>      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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to