The Actor proxy

The Reliable Actors client API provides communication between an Actor instance and an Actor client. To communicate with an Actor, a client creates an Actor proxy object that implements the Actor interface. The client interacts with the Actor by invoking methods on the proxy object. The Actor proxy can be used for client-to-Actor and actor-to-Actor communication. An Actor proxy requires Actor ID and application name to identify the Actor it should connect to. The proxy does not expose the actual Actor location, which is important because the location of the Actor instance can change from time to time for reasons such as cluster node failure. Another important thing to consider is that Actors are required to be idempotent since they may receive the same message from a client more than once. The following line of code creates a proxy that can communicate with an Actor:

var proxy = ActorProxy.Create<IHelloWorldActor>(ActorId.CreateRandom(), "fabric:/APPLICATION NAME"); 

Here, IHelloWorldActor is the contract that the Actor implements. The proxy is generating a random Actor ID to which it wants to communicate with, which is in the Service Fabric application that contains the Actor service hosting the Actor object.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.165.144