Hi,

reading more about DistributedPubSubMediator this seems to be right tool. 
Will try it out. 

Thanks!

On Friday, May 16, 2014 3:07:09 PM UTC+2, Björn Häuser wrote:
>
> Hi Björn :)
>
>
> On Friday, May 16, 2014 2:27:11 PM UTC+2, Björn Antonsson wrote:
>>
>> Hi Björn,
>>
>> On 15 May 2014 at 23:21:26, Björn Häuser ([email protected]) wrote:
>>
>> Hello Akka Users! 
>>
>> I am currently trying to build an Akka Cluster based on Playframework 
>> 2.2. 
>>
>> The Idea I am having is to have an OrderActorSupervisor per Node and 
>> OrderActors for every Order, which are created just once per Cluster. 
>>
>> This is the code I currently have: 
>> https://gist.github.com/bjoernhaeuser/e3ebc59b33cc3f713a5e
>> The config: https://gist.github.com/bjoernhaeuser/da75e14d5fcc5513ddbf
>>
>> What I *thought* is that "context.actorSelection(..)" always gives me the 
>> same Actor in the complete cluster, but currently every node creates their 
>> own OrderActor.
>>
>> I think I have a fundamental misunderstanding or completly wrong 
>> configuration of/for my cluster.
>>
>>
>> So there are no clustered actor paths or selections in the sense that you 
>> can use the same path and get to a single instance inside the cluster. The 
>> akka cluster is about node membership and not about actor state 
>> replication. If one cluster node goes down, then all the actors on that 
>> node will die.
>>
>
> Understood. Dying actors would be ok for me!
>  
>
>>
>> Actor state persistence/replication is handled by the akka-persistence 
>> module in akka 2.3.
>>
>> One solution to having every node create the OrderActor is to use some 
>> consistent hashing of the uuid to decide on which node a certain OrderActor 
>> should be created/looked up. 
>>
>
>> In akka 2.2 you have the DistributedPubSubMediator that you can use to 
>> register actors and send messages to registered paths/topics, but you would 
>> still need to decide yourself on where to place the OrderActors.
>>
>
>
> Let's say we have two nodes, both running playframework. Our Load-Balancer 
> uses both nodes to forward requests to. What I want to do is to either 
> lookup an existing actor in the cluster or create a new one on the node the 
> request arrived. 
>
> So I want to always create an OrderActor on the "current" node, than 
> "register" it in the cluster and than use it from both nodes. At least this 
> is the way I think I want to have ;)
>
> If it happens that all Actors are created on the same node, that would be 
> ok for me. Bad things would happen when they exist on both nodes, because 
> they are doing failry heavly lifting.
>  
>
>>
>> There is Distributed workers with Akka and 
>> Scala<http://typesafe.com/activator/template/akka-distributed-workers> 
>> Activator 
>> template with sample code and a tutorial that shows how to use the 
>> DistributedPubSubMediator.
>>
>> When Play 2.3 is released, and you can use akka 2.3, then you can move to 
>> using the ClusterSharding extension that can probably do what you are 
>> trying to build.
>>
>> B/
>>
>>
> Thanks for helping!
> Björn 
>

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

Reply via email to