Skip to content

Commit c6bc9ac

Browse files
committed
feat: recognize the native worker runtime (gRPC durable protocol)
Add WorkerRuntimeType.Native (and Golang) and treat them like the other gRPC-protocol runtimes (.NET isolated, Java) so Durable Functions works for the Azure Functions Go worker. The Go worker runs under the native worker model: its app sets FUNCTIONS_WORKER_RUNTIME to "native" (see the worker's samples and TECHNICAL_SPEC), and the worker provider declares "language": "golang". The durable extension reads FUNCTIONS_WORKER_RUNTIME via GetWorkerRuntimeType, so it sees "native". Some host builds surface "golang" instead (the worker's integration tests launch func with FUNCTIONS_WORKER_RUNTIME=golang), so both values are recognized; both identify the Go native worker, which uses the gRPC out-of-process protocol exclusively (never the legacy HTTP shim). - IPlatformInformation: new WorkerRuntimeType.Native and Golang. The host parses FUNCTIONS_WORKER_RUNTIME via Enum.TryParse(value.Replace("-",""), ignoreCase), so "native"/"golang" map to these values. - DurableTaskExtension: select the gRPC (MiddlewarePassthrough) protocol for Native/Golang, alongside DotNetIsolated/Java/Custom. This routes orchestrator/activity execution through OutOfProcMiddleware's trigger dispatch and stands up the local gRPC server the worker's durable client connects to (delivered to the worker as the DurableClient binding's rpcBaseUrl). Also mark them as not needing the legacy local HTTP RPC endpoint. - AzureStorageDurabilityProviderFactory: include Native/Golang in the set of runtimes that use a separate queue for entity work items, consistent with the other gRPC-protocol runtimes. Execution remains trigger-replay: the host invokes the orchestration/ activity trigger over FunctionRpc with the encoded request and reads the worker's encoded response, exactly as for .NET isolated and Java. The gRPC server stays management-only (it does not serve a work-item stream).
1 parent 604f45a commit c6bc9ac

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

src/WebJobs.Extensions.DurableTask/AzureStorageDurabilityProviderFactory.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ public AzureStorageDurabilityProviderFactory(
7777
WorkerRuntimeType runtimeType = platformInfo.GetWorkerRuntimeType();
7878
if (runtimeType == WorkerRuntimeType.DotNetIsolated ||
7979
runtimeType == WorkerRuntimeType.Java ||
80+
runtimeType == WorkerRuntimeType.Native ||
81+
runtimeType == WorkerRuntimeType.Golang ||
8082
runtimeType == WorkerRuntimeType.Custom)
8183
{
8284
this.useSeparateQueueForEntityWorkItems = true;

src/WebJobs.Extensions.DurableTask/DurableTaskExtension.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ public DurableTaskExtension(
171171
WorkerRuntimeType runtimeType = this.PlatformInformationService.GetWorkerRuntimeType();
172172
if (runtimeType == WorkerRuntimeType.DotNetIsolated ||
173173
runtimeType == WorkerRuntimeType.Java ||
174+
runtimeType == WorkerRuntimeType.Native ||
175+
runtimeType == WorkerRuntimeType.Golang ||
174176
runtimeType == WorkerRuntimeType.Custom)
175177
{
176178
this.ConfigureForGrpcProtocol();
@@ -262,6 +264,10 @@ private TaskHubWorker InitializeTaskHubWorker()
262264
WorkerRuntimeType.DotNetIsolated => false,
263265
WorkerRuntimeType.Java => false,
264266

267+
// the native worker (e.g. golang) uses the gRPC protocol, so it never starts the HTTP RPC server
268+
WorkerRuntimeType.Native => false,
269+
WorkerRuntimeType.Golang => false,
270+
265271
// everything else - assume the HTTP server
266272
WorkerRuntimeType.Python => true, // This method will only be called for Python if we already know that we are using the HTTP protocol
267273
WorkerRuntimeType.Node => true,

src/WebJobs.Extensions.DurableTask/IPlatformInformation.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,20 @@ public enum WorkerRuntimeType
6161
/// </summary>
6262
Custom,
6363

64+
/// <summary>
65+
/// Native worker runtime, out-of-process via the gRPC protocol. This is the
66+
/// FUNCTIONS_WORKER_RUNTIME value ("native") used by compiled-language workers
67+
/// such as the Azure Functions Go worker.
68+
/// </summary>
69+
Native,
70+
71+
/// <summary>
72+
/// Go (golang), out-of-process via the gRPC protocol. This matches the Go
73+
/// worker provider's declared language; some host builds surface it as the
74+
/// FUNCTIONS_WORKER_RUNTIME value instead of "native".
75+
/// </summary>
76+
Golang,
77+
6478
/// <summary>
6579
/// Unknown worker runtime.
6680
/// </summary>

0 commit comments

Comments
 (0)