On Mon, 2015-10-19 at 21:03 -0700, [email protected] wrote: > In our architecture, we have API servers communicating to an Actor > Cluster. This leads to a few questions: > > > 1. Is there a way to make entityProps dynamic? In the examples here, > it seems that the Props are the same for every Actor. However, in our > use case, every actor has dynamic props (for instance, a database row > id). Is there an elegant way to do this?
You could send this information as part of an init message. But if you need to bake this information in the actor during start, you can name the entity with this row id and infer the id at actor start from its name (this is a bit fragile since it relies on the fact that ClusterSharding is naming the entity from the id they extracted from the message, but it proved to work fine in our context). > 2. It seems like our API servers can either communicate to the cluster > as a Shard Proxy or as a Cluster Client. What are the advantages and > disadvantages of each approach? It seems like the disadvantage of the > Shard Proxy approach is that it requires the API servers to know the > functions to extract entity and shard ids. The disadvantage of the > Cluster Client approach is that it imposes syntactic overhead for > every tell to a remote actor. I don't know what's best. But I would favor HTTP as the language between unrelated systems allowing a better decoupling, and keep Akka remote communications for communications inside the same system. If you want to keep using Akka remoting, I believe the Cluster client way is the best, it kind of enforces a demarcation between your systems. Otherwise you might end-up with running Cluster Sharding entities on nodes not intended for. -- Brice Figureau <[email protected]> -- >>>>>>>>>> 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.
