Re: [akka-user] Akka Concurrency - Trying to call actors in parallel from an actor

2018-02-09 Thread Manuel Bernhardt
Hi, using Await.result will block until the future is resolved. This is why your calls are sequential. For your purpose, you might want to look into combining ask with pipe: https://doc.akka.io/docs/akka/2.5/futures.html# use-with-actors That is, rather than using ask and pipe between actors, it

[akka-user] Akka Cluster Sharding in Chat room app

2018-02-09 Thread Vladyslav Petrov
Hello, I'm investigating the Akka Clustering to scale my project. Now, I have Chat room application based on web-sockets and Akka framework. Each user has own stateful Actor which handle and process messages from friends in chat room. Actor stores the following data: - loggedUser - current u

Re: [akka-user] Akka Cluster Sharding in Chat room app

2018-02-09 Thread Konrad “ktoso” Malawski
Hi there, sharding is the thing that “starts things on the other node”. The thing that “recovers state” is akka persistence: https://doc.akka.io/docs/akka/snapshot/persistence.html?language=scala One often uses those two together, gaining the capability you just hinted at. Happy hakking -- Chee

Re: [akka-user] Akka Cluster Sharding in Chat room app

2018-02-09 Thread Vladyslav Petrov
Konrad, you mean using Cluster Sharding with persistence mode? пятница, 9 февраля 2018 г., 15:21:17 UTC+2 пользователь Konrad Malawski написал: > > Hi there, > sharding is the thing that “starts things on the other node”. > The thing that “recovers state” is akka persistence: > https://doc.akka.

Re: [akka-user] Akka Cluster Sharding in Chat room app

2018-02-09 Thread Konrad “ktoso” Malawski
No. I mean that the sharded actor would extend PersistentActor, which gives you that recovery -- Cheers, Konrad 'ktoso ' Malawski Akka @ Lightbend On February 9, 2018 at 14:21:06, Konrad “ktoso” Malawski ( konrad.malaw...@lightbend.com) wr

Re: [akka-user] Akka Cluster Sharding in Chat room app

2018-02-09 Thread Vladyslav Petrov
Thanks for the quick response. I will try =) пятница, 9 февраля 2018 г., 16:31:42 UTC+2 пользователь Konrad Malawski написал: > > No. > I mean that the sharded actor would extend PersistentActor, which gives > you that recovery > > -- > Cheers, > Konrad 'ktoso ' Malawski > Akka

[akka-user] Re: Akka Concurrency - Trying to call actors in parallel from an actor

2018-02-09 Thread Rob Crawford
Don't use ask() -- you're blocking for no reason. Just tell() the other two actors, and finish what you can with the information you have. Then, when the responses from those two actors come in, do what you can with that information. Jonas and Viktor wrote an article for O'Reilly where they sai

Re: [akka-user] Re: Akka Concurrency - Trying to call actors in parallel from an actor

2018-02-09 Thread Konrad “ktoso” Malawski
Hi Rob, ask is not the problem. The Await’s shown in the above code are. Ask is not blocking, and sometimes perfectly fine. Using Await is an anti pattern in general, but in Actors and other reactive things is where it’s really bad. Please read this section of the docs that shows what blocking ca