--
You received this message because you are subscribed to the Google Groups "Akka Developer List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
Dean Wampler, Ph.D.
@deanwampler
http://polyglotprogramming.com
--
You received this message because you are subscribed to the Google Groups "Akka Developer List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Hi RolandThe thing I'm experimenting with now is an 'actor' scope. This would be a Spring scope that is tied to the lifetime of an actor. The scope would be available when constructing a bean, in its preStart and in its postStop. The scope would be ended after postStop, automatically destroying any Spring-configured beans.
Another benefit is that we could let Spring access the actor's context, provided we could guarantee this only happened in construction, preStart, etc. That would allow Spring to be fully involved in creating child Actor/ActorRef pairs.That seems like it would make it possible for folks to create full actor trees from Spring config (if that's what they wanted to do).
11 mar 2013 kl. 08:54 skrev Rich Dougherty:Another benefit is that we could let Spring access the actor's context, provided we could guarantee this only happened in construction, preStart, etc. That would allow Spring to be fully involved in creating child Actor/ActorRef pairs.That seems like it would make it possible for folks to create full actor trees from Spring config (if that's what they wanted to do).That is a bit what I’m afraid of: making the structure of the actor hierarchy configurable. The point of the supervision hierarchy is to handle failure in line with the logical structure of the application, and that is something which needs proper design. Therefore I don’t think making it configurable after the fact is a good idea.
We should first focus on viewing an actor system (or actor tree) as something which interacts with a DI container “as a whole”, i.e. the internal structure is fixed. There is enough to be done here: injecting beans into actors and exposing the services of the actor system to other beans. Let us start with that part.
On Mon, Mar 11, 2013 at 9:01 PM, Roland Kuhn <goo...@rkuhn.info> wrote:11 mar 2013 kl. 08:54 skrev Rich Dougherty:Another benefit is that we could let Spring access the actor's context, provided we could guarantee this only happened in construction, preStart, etc. That would allow Spring to be fully involved in creating child Actor/ActorRef pairs.That seems like it would make it possible for folks to create full actor trees from Spring config (if that's what they wanted to do).That is a bit what I’m afraid of: making the structure of the actor hierarchy configurable. The point of the supervision hierarchy is to handle failure in line with the logical structure of the application, and that is something which needs proper design. Therefore I don’t think making it configurable after the fact is a good idea.I hear what you're saying, but I'm not sure letting Spring create ActorRefs is always bad, and it might significantly decrease the usefulness of the integration if it couldn't do so.
"Configurable", to my mind, would probably mean a pair of configurations: a production configuration (which is carefully designed) and a unit-testing configuration (with mock/probe actors). This is IMO pretty much the same way as we often suggest people accept ActorRefs in Actor constructors so that they can mock the actors when testing. Nothing too fancy, just some annotations/XML vs the code approach we already recommend.class MyActor(@ActorRef wellKnownService: ActorRef) { … }
Which isn't to say that I'm super pro-Spring configuration for everything. Probably wiring up an entire actor supervision hierarchy with Spring would be impossible anyway since actor initialisation will often involve asynchronous stuff like message passing. Not everything can be handled with DI at construction. But Spring is possibly good for the simple DI at construction case.We should first focus on viewing an actor system (or actor tree) as something which interacts with a DI container “as a whole”, i.e. the internal structure is fixed. There is enough to be done here: injecting beans into actors and exposing the services of the actor system to other beans. Let us start with that part.Injecting beans into actors: yes!Exposing the services of the actor system to other beans: what did you have in mind here? I think users would probably want to access a few ActorRefs at whatever well-known locations form the actor system's API.
CheersRich--
You received this message because you are subscribed to the Google Groups "Akka Developer List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
To illustrate my technical point: an actor which accepts an injected child would only know how to deal with that child’s failures if those failure characteristics were part of the injection contract. Until we can express this notion I would not want to go in that direction, even though—as I said—I agree that it can be very useful.
"Configurable", to my mind, would probably mean a pair of configurations: a production configuration (which is carefully designed) and a unit-testing configuration (with mock/probe actors). This is IMO pretty much the same way as we often suggest people accept ActorRefs in Actor constructors so that they can mock the actors when testing. Nothing too fancy, just some annotations/XML vs the code approach we already recommend.class MyActor(@ActorRef wellKnownService: ActorRef) { … }But this is the benign kind of looking up another actor, right? `actorFor` is fine …
Which isn't to say that I'm super pro-Spring configuration for everything. Probably wiring up an entire actor supervision hierarchy with Spring would be impossible anyway since actor initialisation will often involve asynchronous stuff like message passing. Not everything can be handled with DI at construction. But Spring is possibly good for the simple DI at construction case.We should first focus on viewing an actor system (or actor tree) as something which interacts with a DI container “as a whole”, i.e. the internal structure is fixed. There is enough to be done here: injecting beans into actors and exposing the services of the actor system to other beans. Let us start with that part.Injecting beans into actors: yes!Exposing the services of the actor system to other beans: what did you have in mind here? I think users would probably want to access a few ActorRefs at whatever well-known locations form the actor system's API.Yes, exactly.
On Mon, Mar 11, 2013 at 10:10 PM, Roland Kuhn <goo...@rkuhn.info> wrote:To illustrate my technical point: an actor which accepts an injected child would only know how to deal with that child’s failures if those failure characteristics were part of the injection contract. Until we can express this notion I would not want to go in that direction, even though—as I said—I agree that it can be very useful.
If the scope was configured as 'singleton' then the actor would currently be created outside the actor somewhere, probably under "/user".
If it was configured as 'actor' then the actor would be created as a child of the current actor, with whatever supervision implications. It is identical to context.actorOf(Props(SpringHelper.createActor("x"))) in the actor's constructor.But good points. Probably the singleton-ish path is what we're more interested in, especially so that we can provide these singleton actors to other beans so they can interface with the actor system."Configurable", to my mind, would probably mean a pair of configurations: a production configuration (which is carefully designed) and a unit-testing configuration (with mock/probe actors). This is IMO pretty much the same way as we often suggest people accept ActorRefs in Actor constructors so that they can mock the actors when testing. Nothing too fancy, just some annotations/XML vs the code approach we already recommend.class MyActor(@ActorRef wellKnownService: ActorRef) { … }But this is the benign kind of looking up another actor, right? `actorFor` is fine …Do you mean Spring would call actorFor on the path or would it be done in code?class MyActor(@ActorRef("/user/well/known/service") wellKnownService: ActorRef) { … }Which isn't to say that I'm super pro-Spring configuration for everything. Probably wiring up an entire actor supervision hierarchy with Spring would be impossible anyway since actor initialisation will often involve asynchronous stuff like message passing. Not everything can be handled with DI at construction. But Spring is possibly good for the simple DI at construction case.We should first focus on viewing an actor system (or actor tree) as something which interacts with a DI container “as a whole”, i.e. the internal structure is fixed. There is enough to be done here: injecting beans into actors and exposing the services of the actor system to other beans. Let us start with that part.Injecting beans into actors: yes!Exposing the services of the actor system to other beans: what did you have in mind here? I think users would probably want to access a few ActorRefs at whatever well-known locations form the actor system's API.Yes, exactly.OK. I'll have a think about that.I sense there may be object creation ordering issues since some actors will depend on Spring beans for DI, some actors will be created independently, but some Spring beans will depend on those actors. Possibly could be worked around by using Futures/Promises… or by letting Spring create any actors it needs. ;)First I'll just get the DI into actors stuff working though.CheersRich
--
You received this message because you are subscribed to the Google Groups "Akka Developer List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.