When looking at the durable tasks framework extension for azure functions, it creates some management endpoints at runtime/webhooks/durabletasks/instances
And I concluded that this is the code that handles these requests: https://github.com/Azure/azure-functions-durable-extension/blob/bf9a9b29fccae849840686459175b7d8ae619f67/src/WebJobs.Extensions.DurableTask/HttpApiHandler.cs#L21
but I can't figure out how the extension register these endpoints, as i am creating my own extension and would like to also register additional endpoints.
There are two key components to registering endpoints for an Azure Functions extension.
context.GetWebhookHandler()
as found here.IAsyncConverter<HttpRequestMessage, HttpResponseMessage>
as found here.When both of these conditions are met, the Functions runtime will forward all requests in the API namespace runtime/webhooks/<extension-name>*
to the implementation of IAsyncConverter<HttpRequestMessage, HttpResponseMessage>
. If you look at the Durable Task framework as an example, the HttpApiHandler
then looks at the path and methods of those requests to route the requests to the proper API methods.
There is no way to register endpoints outside of the runtime/webhooks/<extension-name>*
namespace. However, you can create as many endpoints within that namespace as you would like. You as the extension developer are responsible for routing those HttpRequestMessage
objects to the API logic for that endpoint though.