在运行时查找有状态服务的分区键

时间:2019-06-15 03:49:28

标签: azure-service-fabric

我需要在运行时找到Service Fabric状态服务的当前分区键。

我查看了ICodePackageActivationContextStatefulServiceContext,但似乎看不到任何地方的信息。

编辑:

正如LoekD在他的回答中指出的,此信息可从StatefulService类中获得。为了明确起见,这是我的访问方式:

var info = (Int64RangePartitionInformation) this.Partition.PartitionInfo;

var highKey = info.HighKey;
var lowKey = info.LowKey;

1 个答案:

答案 0 :(得分:1)

从服务本身内部,您可以使用Partition.PartitionInfo property

相关问题