I have deployed two Stateless and SinglePartion
Microservices into a Service Fabric cluster, which are hosted on Azure. Now I want to hook up the communication between these services like this:
My Masterdata Web API Service should prefer to communicate with a Masterdata ServiceProxy Service replica/instance on the same node when calling a method via the ServiceProxy client. If there's no replica/instance available on the same node, connect to another node. The code looks like this:
var serviceClient = ServiceProxy.Create<IMasterDataServiceProxy>(new Uri("fabric:/sfApp/MasterDataServiceProxy"));
var result = await serviceClient.GetMasterData();
But actually the communication is like this:
The ServiceProxy connects to a randomly chosen replica/instance (due to TargetReplicaSelector.Default
). I'm missing some communication options like "TargetReplicaSelector.PreferSameNode
". Is there any way to handle this manually?