Up and down counter application

Let's build a simple stateful application that would help us understand the various aspects of a reliable stateful application. We will build an up and down counter that will increment or decrement a counter value depending on the partition it belongs to. We will save the counter value in a ReliableDictionary instance and trace the current state of the dictionary so that we can visualize it in the Diagnostics Event Viewer console.

To begin, using Visual Studio create a new Service Fabric application named StatefulUpDownCounterApplication and add a Stateful Reliable Service to it. Name the service UpDownCounterService:

Create Stateful Service dialog

Let's first create two partitions of this service. For this ...

Get Microservices with Azure now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.