Hi,

Cluster.selfAddress will give you the address of the actor system, and then
you can compare it to Member.address

--
Johan
Akka Team

On Mon, Nov 7, 2016 at 6:18 AM, Unknown Unknown <zx80l...@gmail.com> wrote:

> There is the following actor which belongs to cluster and is subscribed to
> cluster events:
>
>
>     class Worker extends Actor {
>        val cluster = Cluster(context.system)
>        var router = Router(BroadcastRoutingLogic(), Vector.empty[
> ActorRefRoutee])
>
>        override def preStart(): Unit =
>          cluster.subscribe(self, classOf[MemberEvent])
>
>        override def postStop(): Unit = cluster.unsubscribe(self)
>
>
>        def receive = {
>           ...
>           case MemberUp(m: Member)  =>
>             val a = context.actorSelection(
>                        RootActorPath(m.address) / "user" / "worker")
>
>             val isNotSelf:Boolean = ??? //TODO how to check m != self
>             if(isNotSelf)
>                router = router.removeRoutee(a).addRoutee(a)
>            ...
>        }
>     }
>
>
>
>
> In this case the Worker actor belongs to cluster, therefore it add to
> router itself.
>
> How can I check that `MemberUp(m:Member)` does not equal `self` actor (see
> TODO in above code)?
>
> I use akka 2.4.12.
>
> The same question at http://stackoverflow.com/questions/40453413
>
> --
> >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> 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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
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