Programmatic remote actor deployment with multi-node with resizing question

203 visningar
Hoppa till det första olästa meddelandet

D Pars

oläst,
20 feb. 2012 01:00:242012-02-20
till Akka User List
Hi All,

I have a question regarding the programmatic deployment of remote
actors. I understand how to specify multiple target nodes for the
pooling of actors via configuration/application.conf - but was hoping
to be able to do it at the time of actor creation in the context of
messages being sent to a particular supervisor, flexing the nodes
based on business rules.

I got it all working when simply using one node, but per the
following, can not figure out the correct approach for squeezing
multiple addresses in.

The general approach has been the following:

RoundRobinRouter myRouer = new RoundRobinRouter(new DefaultResizer(3,
10));

Address a = AddressExtractor.parse(....);
Address b = AddressExtractor.parse(....);
Address c = AddressExtractor.parse(....);
RemoteScope remoteScope = new RemoteScope(a); // how do I get
multiple addresses in here??

Deploy myDeploy = new Deploy(remoteSope); // or how do i get multiple
remoteScopes in here??

getContext().actorOf(new
Props(SomeActor.class).withRouter(myRouter).withDeploy(myDeploy));

How would I get the resizer nodes split across a, b, and c ? Early
and earnest apologies if the answer to this is obvious and I am just
being dense!

Thanks,
D

Roland Kuhn

oläst,
20 feb. 2012 01:13:222012-02-20
till akka...@googlegroups.com, Akka User List
You raise a good point: this is not documented yet. The target.nodes property corresponds to a RemoteRouterConfig. Disclaimer: I'm on my phone.

.withRouter(RemoteRouterConfig(RoundRobinRouter(5), listOfNodeAddresses))

should do the trick. The RemoteRouterConfig is for deploying the children remotely while the RemoteScope is for deploying the router itself remotely.


Regards,

Roland Kuhn
Typesafe — The software stack for applications that scale
twitter: @rolandkuhn

> --
> 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.
>

D Pars

oläst,
20 feb. 2012 01:52:362012-02-20
till Akka User List
Thanks Roland!

It looks like RemoteRouterConfig takes in a scala.collection.Iterable?
(this is confusing because the scala signature seems to indicate
java.lang.Iterable), but I was unable to pass in a
java.util.ArrayList, but was able to use the following (on 2.0-RC1):

RemoteRouterConfig rc = new RemoteRouterConfig(r, new
JIterableWrapper<String>(nodes));

Regardless, once I did - everything worked! So thank you very much
once again, Roland!

D


On Feb 20, 12:13 am, Roland Kuhn <goo...@rkuhn.info> wrote:
> You raise a good point: this is not documented yet. The target.nodes property corresponds to a RemoteRouterConfig. Disclaimer: I'm on my phone.
>
> .withRouter(RemoteRouterConfig(RoundRobinRouter(5), listOfNodeAddresses))
>
> should do the trick. The RemoteRouterConfig is for deploying the children remotely while the RemoteScope is for deploying the router itself remotely.
>
> Regards,
>
> Roland Kuhn
> Typesafe — The software stack for applications that scale
> twitter: @rolandkuhn
>

rkuhn

oläst,
20 feb. 2012 02:14:582012-02-20
till akka...@googlegroups.com
Good to hear! I created the documentation ticket, which will then be the typical time for fixing up the Java API (first it works, then you see how its usage differs from what you would like to document ;-)).

Thanks for reporting, these omissions are what we hope to find during the RC phase.

Regards,

Roland

Svara alla
Svara författaren
Vidarebefordra
0 nya meddelanden