Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Service Fabric Stateful Service Remoting V2

I have a Stateful Service called by a Stateless service, in .Net Standard Asp.net Core 2.0 running on Visual Studio 15.4. I can't make the Service Remoting V2 work.

The old code in the Stateful service that worked for V1 is not valid anymore

  protected override IEnumerable<ServiceReplicaListener> CreateServiceReplicaListeners()
    {
        return new List<ServiceReplicaListener>()
            {
                new ServiceReplicaListener((context) =>this.CreateServiceRemotingListener(context))
            };

I tried to follow this tutorial but the example is for the stateless one.

I tried to change the code in this without success.

protected override IEnumerable<ServiceReplicaListener> CreateServiceReplicaListeners()
    {
        return new List<ServiceReplicaListener>()
            {
                new ServiceReplicaListener((c) =>new FabricTransportServiceRemotingListener(c, this))
            };
    }

Also there are no instructions on how or where to use this code in the tutorial

var proxyFactory = new ServiceProxyFactory((c) =>
   {
       return new FabricTransportServiceRemotingClientFactory();
   });

I'm stuck, could someone show me how to make it work?

like image 693
Francesco Cristallo Avatar asked Oct 14 '17 11:10

Francesco Cristallo


1 Answers

In your stateful service, in method CreateServiceReplicaListeners, use this code:

protected override IEnumerable<ServiceReplicaListener> CreateServiceReplicaListeners()
{
    return this.CreateServiceRemotingReplicaListeners();
}

And in the file that defines your remoting service interface, add this:

[assembly: FabricTransportServiceRemotingProvider(RemotingListener = RemotingListener.V2Listener, RemotingClient = RemotingClient.V2Client)]

(for example, just below the using namespaces list.)

Add the endpoint: <Endpoint Name="ServiceEndpointV2" />

And rebuild the client.

like image 99
LoekD Avatar answered Oct 18 '22 19:10

LoekD