It is possible to persist the state of an entity in Durable Azure Function. This state is not lost even when the function restarts and can be accessed accross instances of Azure Function, regardless of on which server the function runs.
- increment: [GET,POST] http://localhost:7071/api/increment
- decrement: [GET,POST] http://localhost:7071/api/decrement
- getCounter: [GET] http://localhost:7071/api/getCounter
To run the example, the Azure Storage Emulator has to installed locally.
- Build and run the example.
- Call the increment API multiple times from the browser itself.
- Call the getCounter API to see the current value of the counter.
- Stop the Counter Example Azure Function
- Run the Azure Function again
- Check the last value of the counter by calling getCounter API
- Our counter value is still the same, as we had before stopping the Azure Function. Cheers!