How do I inject DurableTaskClient into services? #2934
-
If I'm Azure Functions Isolated and this nuget package: <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.DurableTask" Version="1.1.7" /> I can get access to a DurableTaskClient in a function with this binding: [DurableClient] DurableTaskClient client How do I get access to the same client in other services? For example, I have a class like this: public class MyService(DurableTaskClient client) {
. . .
} And I have it plugged into my services like: services.AddScoped<MyService>() I get the following error message:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
By other services, do you mean like other than Azure Functions (such as App Service, AKS, etc.)? This is possible, but not really documented. @jviau by chance do you have a sample that shows how to create external clients using |
Beta Was this translation helpful? Give feedback.
This is not possible today in .NET isolated, as the server information for the gRPC client is only included in the binding payload itself. When Durable moves to using the functions host provided gRPC server, then it will be known at startup and the client can be included in the service container.