Skip to content

Latest commit

 

History

History
59 lines (47 loc) · 2.9 KB

README.md

File metadata and controls

59 lines (47 loc) · 2.9 KB

NwnServerStatus.Functions

Exploring Azure Durable Functions by polling for game servers with Beamdog's NWMasterJsonApi.

Requirements

Setup

Clone the repository and follow these steps.

1. Add local.settings.json

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"
  }
}

2. AzureWebJobsStorage

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.

a. Using an Azure Storage Account

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.

b. Using Azurite

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

Usage

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.

Docs