Search code examples
c#azure-service-fabricservice-fabric-actor

Reliable Actor with multiple interfaces?


Is there a way to create an actor that has two interfaces? I want to define the public interface in the Interfaces assembly and the internal interface in the actor assembly. The reason is to separate methods that clients should use and methods that the system should use.

For example:

class MyActor
    : Actor
    , IPublicInterface
    , IInternalInterface
{
    ...
}

It looks like this is not possible because the ActorService attribute only allows for a single name.

Is there a better way (that works) to segregate public and internal methods?


Solution

  • When you have more than one interface, the runtime cannot generate the default name for the service. You need to apply https://msdn.microsoft.com/en-us/library/azure/microsoft.servicefabric.actors.runtime.actorserviceattribute.aspx

    [ActorService(Name="MyActorService")] to your actor implementation. You can then create the actor proxy with this servicename using https://msdn.microsoft.com/en-us/library/azure/mt694503.aspx method.