Service Fabric - QueryClient

17 views Asked by At

I am trying to use the FabricClient -> QueryClient to get the "instanceOrReplicaId" for a particular Application running on an on-premise service fabric instance.

For background information, the cluster is running version 10.1.1541.9590 and the NuGet package for the FabricClient is Microsoft.ServiceFabric.Services v7.1.1541.

var replicaList = await _fabricClient.QueryManager.GetDeployedReplicaListAsync(node.NodeName, application.ApplicationName);

This effectively returns a list of DeployedServiceReplica objects, which has two super classes DeployedStatefulServiceReplica and DeployedStatelessServiceInstance depending on whether the service is stateless or stateful.

The stateless has a property InstanceId and the the stateful has one called ReplicaId, which probably explains why the FabricClient -> ServiceManager has methods that take a variable replicaOrInstanceId...

The issue, I see is the id returned in both case doesn't match the InstanceId shown in Service Fabric Explorer. All the rest of the details match, including the PartitionId and the HostProcessId.

If I use the Powershell script: Get-ServiceFabricReplica -PartitionId c9fb833d-738b-4055-8252-65564f656c0e

then the correct InstanceId is shown.

The InstanceId returned from the FabricClient -> QueryClient doesn't appear anywhere in Service Fabric Explorer...

The one shown in Service Fabric explorer and via Powershell is: 133512992049797897

Whereas, the one returned from the FabricClient -> QueryClient is: 133512989560960690

I assume I am using the wrong SDK function, but any help would be appreciated!

I have tried using various different methods in the FabricClient -> QueryManager including:

GetServiceListAsync GetPartitionListAsync GetReplicaListAsync GetPartitionAsync

The id's I get back are consistent, but consistently incorrect.

0

There are 0 answers