Problem
DurableTaskAzureManagedWorkerBuilder provides fluent builder methods for registering orchestrators (addOrchestrator, addNamedOrchestrator) and activities (addActivity, addNamedActivity), but has no corresponding methods for entity registration.
Users who need entities must call worker.addEntity() or worker.addNamedEntity() directly on the TaskHubGrpcWorker returned by build(), breaking the fluent builder pattern:
// Current workaround (inconsistent with orchestrator/activity registration)
const worker = new DurableTaskAzureManagedWorkerBuilder()
.endpoint(endpoint, taskHub, null)
.addNamedOrchestrator('myOrch', orchestrator)
.addNamedActivity('myActivity', activity)
.build();
worker.addNamedEntity('CounterEntity', () => new CounterEntity()); // Must break the chain
This gap is visible in the e2e entity tests (test/e2e-azuremanaged/entity.spec.ts), which all use the direct worker method instead of the builder.
File: packages/durabletask-js-azuremanaged/src/worker-builder.ts
Root Cause
Entity support was added to the core TaskHubGrpcWorker but the Azure managed builder wrapper was not updated to expose the same registration methods.
Proposed Fix
Add addEntity(factory) and addNamedEntity(name, factory) methods to DurableTaskAzureManagedWorkerBuilder, following the exact same pattern used for orchestrators and activities. Store entity factories during configuration and register them on the worker during build().
Impact
Severity: Low — functional workaround exists.
Affected scenarios: Any Azure managed Durable Task user who wants to register entities through the builder pattern. The builder's own useWorkItemFilters documentation (line 228) already references entities, suggesting they were intended to be registerable through the builder.
Problem
DurableTaskAzureManagedWorkerBuilderprovides fluent builder methods for registering orchestrators (addOrchestrator,addNamedOrchestrator) and activities (addActivity,addNamedActivity), but has no corresponding methods for entity registration.Users who need entities must call
worker.addEntity()orworker.addNamedEntity()directly on theTaskHubGrpcWorkerreturned bybuild(), breaking the fluent builder pattern:This gap is visible in the e2e entity tests (
test/e2e-azuremanaged/entity.spec.ts), which all use the direct worker method instead of the builder.File:
packages/durabletask-js-azuremanaged/src/worker-builder.tsRoot Cause
Entity support was added to the core
TaskHubGrpcWorkerbut the Azure managed builder wrapper was not updated to expose the same registration methods.Proposed Fix
Add
addEntity(factory)andaddNamedEntity(name, factory)methods toDurableTaskAzureManagedWorkerBuilder, following the exact same pattern used for orchestrators and activities. Store entity factories during configuration and register them on the worker duringbuild().Impact
Severity: Low — functional workaround exists.
Affected scenarios: Any Azure managed Durable Task user who wants to register entities through the builder pattern. The builder's own
useWorkItemFiltersdocumentation (line 228) already references entities, suggesting they were intended to be registerable through the builder.