azure-functions-durable-python/samples/counter_entity
David Justo b03ca648cc
host.json in entity sample now uses bundles (#296)
2021-06-23 14:15:13 -07:00
..
Counter Durable Entities (#184) 2020-12-03 11:26:29 -08:00
DurableOrchestration Durable Entities (#184) 2020-12-03 11:26:29 -08:00
DurableTrigger Durable Entities (#184) 2020-12-03 11:26:29 -08:00
RetrieveEntity Added read_entity_state to DurableOrchestrationClient (#285) 2021-06-04 10:08:54 -07:00
.funcignore Durable Entities (#184) 2020-12-03 11:26:29 -08:00
.gitignore Durable Entities (#184) 2020-12-03 11:26:29 -08:00
README.md Added read_entity_state to DurableOrchestrationClient (#285) 2021-06-04 10:08:54 -07:00
host.json host.json in entity sample now uses bundles (#296) 2021-06-23 14:15:13 -07:00
local.settings.json Durable Entities (#184) 2020-12-03 11:26:29 -08:00
requirements.txt host.json in entity sample now uses bundles (#296) 2021-06-23 14:15:13 -07:00

README.md

Durable Entities - Sample

This sample exemplifies how to go about using the Durable Entities construct in Python Durable Functions.

Usage Instructions

Create a local.settings.json file in this directory

This file stores app settings, connection strings, and other settings used by local development tools. Learn more about it here. For this sample, you will only need an AzureWebJobsStorage connection string, which you can obtain from the Azure portal.

With you connection string, your local.settings.json file should look as follows, with <your connection string> replaced with the connection string you obtained from the Azure portal:

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "<your connection string>",
    "FUNCTIONS_WORKER_RUNTIME": "python"
  }
}

Run the Sample

To try this sample, run func host start in this directory. If all the system requirements have been met, and after some initialization logs, you should see something like the following:

Http Functions:

        DurableTrigger: [POST,GET] http://localhost:7071/api/orchestrators/{functionName}

This indicates that your DurableTrigger function can be reached via a GET or POST request to that URL. DurableTrigger starts the function-chaning orchestrator whose name is passed as a parameter to the URL. So, to start the orchestrator, which is named DurableOrchestration, make a GET request to http://127.0.0.1:7071/api/orchestrators/DurableOrchestration.

And that's it! You should see a JSON response with five URLs to monitor the status of the orchestration.

Retrieving the state via the DurableOrchestrationClient

It is possible to retrieve the state of an entity using the read_entity_state function. As an example we have the RetrieveEntity endpoint which will return the current state of the entity:

Http Functions:

        RetrieveEntity: [GET] http://localhost:7071/api/entity/{entityName}/{entityKey}

For our example a call to http://localhost:7071/api/entity/Counter/myCounter will return the current state of our counter.