Search code examples
rpcazure-service-fabric

Connect to node instance via RPC endpoint in Azure Service Fabric


I have a stateless service on multiple nodes with dynamic endpoints.

I want to use the ServiceProxy with their dynamic endpoint like this one:

localhost:32010+dd1d0a27-1dec-49db-8960-83bf001355be-131329828855327547

How do I use ServiceProxy to connect to the specific node instance using that endpoint?

I'm instantiating the ServiceProxy like this:

ServiceProxy.Create<T>(new Uri("fabric:/XXX));, which will only find one of the instance nodes. I want to specify the node to connect to via the endpoint. How do I do that?


Solution

  • There is no way to use Service Remoting to connect to a specific instance of a Stateless Service. You can only target specific partitions/replicas for Stateful Services.

    Look at this SO answer.

    Your options are basically:

    • Change to HTTP communication
    • Redesign as a Stateful Service

    Another thing you might want to ask yourself is why you want to target a specific instance or node? Is it because you wan't some performance benefit? Do you have some other type of affinity from the client to the service you want to target?