Event routing question

43 views
Skip to first unread message

Thomas Bernhardt

unread,
May 1, 2012, 3:00:31 PM5/1/12
to akka...@googlegroups.com
I have a question please towards routing an event to remote actors:
Lets say I have node A hosting Akka actor A1, and node B hosting Akka actors B1 and B2.
A1 needs to send the same event to B1 and B2, however the event should only get serialized and transported to node B once, since there can be many B actors.
Is there an optimization or abstraction within Akka to make sure it is transported only once or do I need to write my own router perhaps?

Thank you!
Best regards,
Tom

Henrik Engström

unread,
May 2, 2012, 1:23:05 AM5/2/12
to akka...@googlegroups.com
Hi Tom,
You don't have to write your own router, you can use one from Akka.
Create a router Br on node B and have it forward the message to your
B1...Bn actors.
In your particular case the BroadcastRouter seems to be the right candidate.
See http://doc.akka.io/docs/akka/2.0.1/scala/routing.html
Cheers
//Henrik
> --
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To post to this group, send email to akka...@googlegroups.com.
> To unsubscribe from this group, send email to
> akka-user+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/akka-user?hl=en.

Thomas Bernhardt

unread,
May 2, 2012, 7:58:49 AM5/2/12
to akka...@googlegroups.com
Thank you Henrik.

The concern I would have is that I don't want my code to know where these B1..Bn actors live. For example, they could be B1..B10 on node B and B11 to B13 on node C (distributed in any random fashion). I would like Akka and Akka Cluster to know where these actors currently live and route accordingly. Is this type feature on the Akka roadmap please?

Best regards,
Tom

From: Henrik Engström <henrik....@gmail.com>
To: akka...@googlegroups.com
Sent: Wednesday, May 2, 2012 1:23 AM
Subject: Re: [akka-user] Event routing question

> For more options, visit this group at
> http://groups.google.com/group/akka-user?hl=en.

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+unsub...@googlegroups.com.

Henrik Engström

unread,
May 3, 2012, 5:47:45 AM5/3/12
to akka...@googlegroups.com
Hi again,
Clustering will take care of this for you.
You can read more about the proposed Akka clustering here:
https://github.com/akka/akka/blob/master/akka-docs/cluster/cluster.rst
Cheers
//Henrik
>> akka-user+...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/akka-user?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To post to this group, send email to akka...@googlegroups.com.
> To unsubscribe from this group, send email to
> akka-user+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/akka-user?hl=en.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To post to this group, send email to akka...@googlegroups.com.
> To unsubscribe from this group, send email to
> akka-user+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages