Eli*_*bel 12
您可以使用FabricClient以下命令枚举分区:
var serviceName = new Uri("fabric:/MyApp/MyService");
using (var client = new FabricClient())
{
var partitions = await client.QueryManager.GetPartitionListAsync(serviceName);
foreach (var partition in partitions)
{
Debug.Assert(partition.PartitionInformation.Kind == ServicePartitionKind.Int64Range);
var partitionInformation = (Int64RangePartitionInformation)partition.PartitionInformation;
var proxy = ServiceProxy.Create<IMyService>(serviceName, new ServicePartitionKey(partitionInformation.LowKey));
// TODO: call service
}
}
Run Code Online (Sandbox Code Playgroud)
请注意,您应该缓存结果,GetPartitionListAsync因为在不重新创建服务的情况下无法更改服务分区(您可以只保留LowKey值列表).
此外,FabricClient还应尽可能共享(参见文档).
| 归档时间: |
|
| 查看次数: |
1821 次 |
| 最近记录: |