Resolve-​Service​Fabric​Service

Retrieves the replica address of a stateful Service Fabric partitioned service or the address of an instance of a stateless Service Fabric service.

Syntax

Resolve-ServiceFabricService
       [-PartitionKindSingleton]
       [-ServiceName] <Uri>
       [-ForceRefresh]
       [-TimeoutSec <Int32>]
       [<CommonParameters>]
Resolve-ServiceFabricService
       [-PartitionKindUniformInt64]
       [-ServiceName] <Uri>
       [-PartitionKey] <String>
       [-ForceRefresh]
       [-TimeoutSec <Int32>]
       [<CommonParameters>]
Resolve-ServiceFabricService
       [-PartitionKindNamed]
       [-ServiceName] <Uri>
       [-PartitionKey] <String>
       [-ForceRefresh]
       [-TimeoutSec <Int32>]
       [<CommonParameters>]
Resolve-ServiceFabricService
       [-PartitionKindUniformInt64]
       [-ServiceName] <Uri>
       [-PartitionKey] <String>
       [-PreviousResult <ResolvedServicePartition>]
       [-TimeoutSec <Int32>]
       [<CommonParameters>]
Resolve-ServiceFabricService
       [-PartitionKindNamed]
       [-ServiceName] <Uri>
       [-PartitionKey] <String>
       [-PreviousResult <ResolvedServicePartition>]
       [-TimeoutSec <Int32>]
       [<CommonParameters>]
Resolve-ServiceFabricService
       [-PartitionKindSingleton]
       [-ServiceName] <Uri>
       [-PreviousResult <ResolvedServicePartition>]
       [-TimeoutSec <Int32>]
       [<CommonParameters>]

Description

The Resolve-ServiceFabricService cmdlet retrieves the replica address of a stateful Service Fabric partitioned service or the address of an instance of a stateless Service Fabric service.

The address is cached on the local node and can be refreshed if the connection attempt to the address fails. The failure to connect typically indicates that the replica or the instance has moved to a different node.

Before you perform any operation on a Service Fabric cluster, establish a connection to the cluster by using the Connect-ServiceFabricCluster cmdlet.

Examples

Example 1: Resolve addresses

PS C:\> Resolve-ServiceFabricService -PartitionKindUniformInt64 -ServiceName fabric:/myApp/myService -PartitionKey "0"

This command retrieves the addresses of a uniform Int64 partition mapped to by partition key 0 in a service named fabric:/myApp/myService.

Example 2: Using previous result to refresh local cache

PS C:\> $result = Resolve-ServiceFabricService -ServiceName fabric:/TestApplication/TestService/1 -PartitionKindSingleton
PS C:\> Resolve-ServiceFabricService -ServiceName fabric:/TestApplication/TestService/1 -PartitionKindSingleton -PreviousResult $result

This command provides the result of the first resolve call to the subsequent one. This is required if the user knows that the result previously obtained in the first call is stale. The endpoints are considered stale if the connection request times out or returns an error.

Example 3: Force refresh local cache

PS C:\> Resolve-ServiceFabricService -ServiceName fabric:/TestApplication/TestService/1 -PartitionKindSingleton -ForceRefresh

This command retrieves the address of a stateful replica in a singleton partition after forcefully refreshing the local endpoint cache.

Required Parameters

-ForceRefresh

Indicates that the cmdlet forces the local cache of resolved addresses to refresh.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-PartitionKey

Specifies the partition key for the Service Fabric service.

Type:String
Position:3
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-PartitionKindNamed

Indicates that the Service Fabric service is a named partition.

Type:SwitchParameter
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PartitionKindSingleton

Indicates that the Service Fabric service is a singleton partition.

Type:SwitchParameter
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PartitionKindUniformInt64

Indicates that the Service Fabric service is a UniformInt64 partition.

Type:SwitchParameter
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ServiceName

Specifies the URI of a Service Fabric service.

Type:Uri
Position:2
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-PreviousResult

Specifies the previous resolve service partition results. This is required if the user knows that the result that was obtained previously is stale.

Type:ResolvedServicePartition
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-TimeoutSec

Specifies the time-out period, in seconds, for the operation.

Type:Int32
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

System.Uri, String, System.Fabric.ResolvedServicePartition

This cmdlet accepts a URI that represents the name of a Service Fabric service, or the partition key as a string, or a System.Fabric.ResolvedServicePartition object that represents a previous resolve service partition result.

Outputs

System.Object

This cmdlet returns a System.Fabric.ResolvedServicePartition object that represents the Service Fabric resolved service partition.