Exploring Azure Durable Functions by polling for game servers with Beamdog's NWMasterJsonApi.
- .NET 6
- Azure Functions Core Tools
- One of:
- Azurite
- Azure Storage Account
Clone the repository and follow these steps.
Required to run Azure Functions locally. You may simply copy-paste the following for development runtime.
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet"
}
}
Azure Functions requires a storage to store its state. I recommend using azurite for this locally, but you can also choose to use a live storage account on Azure.
If you have an Azure Storage Account available and wish to use it, add its connection string as the value of AzureWebJobsStorage
in local.settings.json
from the previous step. Please note that using a live storage account for development purposes may incur unwanted costs, as well as unpredictable behaviour when you run varying versions of your functions.
Azurite may be run via the VS Code extension or the command line. I recommend the latter, and I recommend running the following command from the root of your project. That way you will easily be able to delete the generated storage files if you need to "reset".
azurite --blobHost
dotnet restore
dotnet build
func start
Once the project is running you can start triggering its functions via its HTTP triggers. Use cURL, a browser, Postman, whichever. All current HTTP triggers respond to both GET and POST.
For example, to start polling the server at 46.4.59.55:5123
, run your functions with func start
, then:
curl http://localhost:7071/api/poll/46.4.59.55/5123
You should receive a response which includes statusQueryGetUri
. This address is used to fetch the polling orchestration's current status once it has been triggered.