I have a little problem to solve at the moment and it seems that I am not finding the right solution for me in the SF Framework. The problem is simple though and consists in:
I have a Int64RangePartition that allows me to find all the partitions of the service through:
_fabricClient.QueryManager.GetPartitionListAsync(_globalStatsSvcUri)
This works fine but unlike the NamedPartitions scheme it seems not possible to create a service proxy (with remoting) to use the service without providing the Int key.
IGlobalStatsSvc globalStatsSvc = ServiceProxy.Create(_globalStatsSvcUri, partitionKey);
My specific case is that I want to be able to scale a parallel statistics computation service but want to be able to keep a connection with the profiles IDs. Therefore I would like to choose the Int64RangePartition scheme.
But when I need to query the global statistics of the system I need to call all the partitions in parallel and then aggregate the Avg, Variance and Std with the Chan' algorithm.
In order to do so, I need to be able to create a proxy without knowing which Int key is mapping to the partition. I need only the partition Key Id.
Sadly, it seems that SF allows only to do the latter in the NamedPartition scheme and not the RangedPartition.
Has anyone a solution for this particular case? Choosing the NamedPartition scheme could work but it is more complicated in the case the stats are modified (need at least to ensure that the random partition name is compatible statistically). The other solution would be to "manually" create the proxy to the service as I should be able to build the URL with the partition ID I resolved. But it is more work and by pass the strongly typed client provided by SF.
It would be much simpler to mix the two behaviours with the RangedPartition scheme, as I would be able to know which partition to modify at edit time and then query all partitions at reading time when I need to do the aggregation.
Found the solution to the problem, I am still pretty new to the SF Framework but when one queries the partitions list of a service, information about the low and high key of the specific partition is given.
Therefore one only needs to pass those IDs before a call to the service via a proxy.
Simple enough:
var partitionInformation = partition.PartitionInformation as Int64RangePartitionInformation;
var partitionKey = new ServicePartitionKey(partitionInformation.LowKey);