How can i create an actor in akka cluster Sharding dynamically with Cluster Client which will pass message from out side the cluster with akka remoting.
How to create an actor in Akka cluster dynamically
446 Views Asked by Arun At
1
There are 1 best solutions below
Related Questions in AKKA
- Akka actor invoked with a function delegate - is this bad practice?
- Akka supervisor on stop of subordinate
- Scala - TCP Packet frame using Akka
- Akka-http process requests with Stream
- Multiple dispatcher for spray
- Spray Dead Letter msg
- ActorNotFound Exception trying to run Spark 1.3.1 on windows 7
- What's the best way to get members of an Akka cluster?
- Is it possible to await for second response in Scala
- How to keep Akka running all the time in Play 2.3
- Suspending AKKA actor
- Spray Client (i.e. AKKA) within Tomcat, cause Threading issue
- Can I use Akka scheduler to schedule multiple things from a single actor context?
- akka: pattern for combining messages from multiple children
- Akka: multiple dispatcher vs multiple actor system
Related Questions in AKKA.NET
- How to use TestKit in Akka.NET
- Testing Akka.NET's Context.Parent with TestKit
- Service Fabric, Akka.net and Persistent actor integration
- HOCON format for cluster router group?
- Akka design for Scraping
- Akka.NET + Photon Server
- Akka.Net Sending huge messages (maximum-frame-size)
- How to make Akka.NET's ClusterClient work?
- How to distinguish actor termination reason
- How to test DistributedPubSub with the TestKit in Akka.net?
- How to handle a stale akka.net remote iactorref
- AKKA.NET - Queuing and Retry
- Akka.net vs Orleans performance
- Is there any way to wait for actor to be completely stopped?
- How to connect a Xamarin Client to Akka.net
Related Questions in AKKA-CLUSTER
- What's the best way to get members of an Akka cluster?
- How to broadcast message to all actors in an AKKA cluster in java?
- Combining Spray Routing + Actor Pattern Matching
- Akka member(actor) lookup in cluster
- Akka cluster sharding: recovering on journal corruption
- How to configure akkacluster using SSL support
- Sending Akka HttpEntity between actors
- How can I test a publisher to a DistributedPubSub in Akka Cluster?
- How can I test a Subscriber's receive method in Akka Cluster?
- AKKA- how to block the creation of an actor if its name is not uniqe in the cluster
- Akka - router supervisorStrategy- how to send message to router on event
- How to run an Akka-HTTP server inside an Akka cluster?
- Akka - cluster aware router doesn't starts nodes
- akka simple cluster with two seed nodes
- Router supervisor strategy in config
Related Questions in AKKA-REMOTE-ACTOR
- Listening to a remote akka ActorSystem's log stream
- akka remote actor running on local actor
- How to watch remote Akka Actor?
- Akka Remote Performance issue
- Can we avoid creating of internal actor when doing ask re
- Unable to start Activity:No configuration setting found for key 'akka.version'
- No response from remote for outbound association. Associate timed out after [15000 ms]
- How to handle million individual actors with AKKA Cluster setup?
- Any blogs,articals or docs to learn AKKA Remote internals?
- How to use Cluster singlton or Cluster sharding in Akka-Cluster for million individual Actors?
- Why does Akka not return address/host info?
- Akka.NET: Dead Letters to Remote Actor
- Dropping message [Akka.Actor.ActorSelectionMessage] for non-local recipient
- Deserialization and classloading in Akka - NoClassDefFoundError
- AKKA Remote Actor Error
Related Questions in AKKA-REMOTING
- How to handle a stale akka.net remote iactorref
- Akka - cluster aware router doesn't starts nodes
- Akka Remote Performance issue
- Can we avoid creating of internal actor when doing ask re
- No response from remote for outbound association. Associate timed out after [15000 ms]
- Any blogs,articals or docs to learn AKKA Remote internals?
- Cannot establish remote communication with Akka
- Why does Akka not return address/host info?
- Akka.NET: Dead Letters to Remote Actor
- Akka.Net Stream Ordering (Stream Ordering Over the Network)
- How to create an actor in Akka cluster dynamically
- How can we send a message from an actor system outside the Akka Cluster
- Akka Cluster basic clarifications about creating actors dynamically
- How do i keep Akka Java actors alive on remote systems ready receive message-deployment?
- Unreachable remote akka actor
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
So you don't provide a lot of details about what you using (Typed vs Untyped, JVM or .NET). But, regardless, the short answer is just "send a message to the
ShardRegion". The whole gist of sharding is that the actor is dynamically created automatically and transparently whenever a message is received.e.g. If you have a Customer actor, and you send a "get the account balance of account 1001" the ShardRegion will automatically extract the customer number from the message, figure out which shard that actor belongs in, and route the message to the node that owns that shard. The ShardRegion on that node will then automatically create the Actor (if it doesn't already exist) and then forward the message to the actor.
So, the even shorter answer is "it just happens automatically as needed". But it sounds like you might want to read through all of the sharding documentation just so you understand what is going on.
EDIT (Responding to a comments):
I was trying to reply to the following comment. But it was too long to respond in a comment so I'm adding this section.
Part of the challenge of answering this question is that there is some ambiguity in what you mean by "create an actor".
Fundamentally the only direct way that an actor is created is an actor spawning a child. There is a root level actor associated with the actor system. That can spawn children. And then the children can spawn children, and so forth. All of those children and sub children are, by definition, on the same node. So in this "direct" interpretation, all actor creation is ALWAYS local. No matter what. Full stop.
Furthermore, you specifically mention cluster client. Which means that you are a client and not an actor. Which means, in the strictest sense of the term, you cannot create actors. At all. Remotely or locally, it doesn't matter, you can't create actors AT ALL if you are a cluster client. Only actors can create actors.
But, in practical terms, this isn't true. Because a very common case is that actors will allow you to spawn actors indirectly in response to a message. This is what cluster sharding does: it essentially runs a "proxy" on every node that will automatically spawn actors as needed. The proxies will even stop and restart an actor on a different node to "rebalance" as needed.
Which goes back to my original point, that there is nothing magic about how cluster sharding does this. You could run your own proxy on each node. Either directly. Or via a cluster based router. Or via an event bus. Or any of a bunch of other mechanisms.
So, getting back to your specific question:
To a certain extent, the question doesn't really make sense. As noted above, as a cluster client, you can't actually create actors at all.
But once you start talking about indirect creation, it's basically whatever you want, it just depends on how you write it.
In Akka Sharding, which was your original question, the actors will be created on whatever node their hash dictates. Which hopefully is fairly uniform but might not be exactly even. But the sharding API doesn't have a "create actor" API, it just creates actors as needed.
On the other hand, if you using some sort of cluster aware router to spawn actors, the functionality can be whatever you desire.
But I feel like this question is getting too vague to answer meaningfully.