Search code examples
c#microservicesazure-service-fabricpartitioningstateless

How partition a stateless Service Fabric service


I would like to partition a stateless Service Fabric service. I didn't find how can I do that. I want to set the number to 10 for example.

ApplicationManifest.xml

  <Parameters>
    <Parameter Name="MyService_InstanceCount" DefaultValue="-1" />
    <Parameter Name="MyService_PartitionCount" DefaultValue="10" />
  </Parameters>

Solution

  • ApplicationManifest.xml

    <Parameters>
        ...
        <Parameter Name="MyService_PartitionCount" DefaultValue="10" />
    </Parameters>
    ...
    <Service Name="MyService" ServicePackageActivationMode="ExclusiveProcess">
        <StatelessService ServiceTypeName="MyServiceType" InstanceCount="[MyService_InstanceCount]">
            <UniformInt64Partition PartitionCount="[MyService_PartitionCount]" LowKey="0" HighKey="9" />
        </StatelessService>
    </Service>