Initial integration of Durable Task Scheduler (i.e. emulator) #9294
Initial integration of Durable Task Scheduler (i.e. emulator) #9294philliphoff wants to merge 16 commits intomainfrom
Conversation
|
Looks like I need to get a couple packages into the Azure DevOps feeds:
|
| return WebUtility.UrlEncode(value); | ||
| } | ||
|
|
||
| string IManifestExpressionProvider.ValueExpression => WebUtility.UrlEncode(_reference.ValueExpression); |
There was a problem hiding this comment.
Good to know! Will be happy to drop this implementation when there's a common solution.
|
|
||
| var app = builder.Build(); | ||
|
|
||
| app.MapPost("/create", async ([FromBody] EchoValue value, [FromServices] DurableTaskClient durableTaskClient) => |
There was a problem hiding this comment.
It magically knows!
| app.MapPost("/create", async ([FromBody] EchoValue value, [FromServices] DurableTaskClient durableTaskClient) => | |
| app.MapPost("/create", async (EchoValue value, DurableTaskClient durableTaskClient) => |
| clientBuilder.UseDurableTaskScheduler( | ||
| builder.Configuration.GetConnectionString("taskhub") ?? throw new InvalidOperationException("Scheduler connection string not configured."), | ||
| options => | ||
| { | ||
| options.AllowInsecureCredentials = true; | ||
| }); |
There was a problem hiding this comment.
Should we build a client integration?
There was a problem hiding this comment.
...yes? It's complicated because consuming applications can be either DTS "clients" or "workers" (and sometimes both), and there are separate SDKs for each which means multiple client integrations. Also, there are two sets of SDKs that apps can use (and you might consider another scenario a third) which further expands the matrix.
I'd say we should start with client integrations for the "modern" SDK, worker first and then client, as the former is the most common. Then, if there's demand, look at integrations for the "older" SDKs. That said, any client integrations would be follow up PRs.
|
|
||
| var scheduler = | ||
| builder.AddDurableTaskScheduler("scheduler") | ||
| .RunAsExisting(builder.AddParameter("scheduler-connection-string")); |
There was a problem hiding this comment.
The intent was to have examples that demonstrate the two main DTS scenarios: use of the DTS emulator and use of an existing DTS instance.
There was a problem hiding this comment.
One thing I'm having a hard time understanding is the deployment story here. Is this an azure resource as well?
There was a problem hiding this comment.
Yes, DTS is an Azure resource (though I'm not intending to support deployment in this initial pass). I did a little experimenting with the Bicep base resource type that other Azure resources are built upon, but they rely on Azure provisioning libraries that do not exist, yet, for DTS.
There was a problem hiding this comment.
So this model is going to be:
AddAzureDurableTaskScheudler().RunAsEmulator() yes?
|
|
||
| namespace Aspire.Hosting.Azure; | ||
|
|
||
| interface IResourceWithDashboard : IResource |
There was a problem hiding this comment.
style nit:
| interface IResourceWithDashboard : IResource | |
| internal interface IResourceWithDashboard : IResource |
There was a problem hiding this comment.
Also, do we need this? This naming is very generic and only used by one resource.
There was a problem hiding this comment.
It's used by both DTS resources, where each implements in a slightly different manner. I've updated the name to be DTS specific.
| builder | ||
| .WithEndpoint(name: DurableTaskConstants.Scheduler.Emulator.Endpoints.Worker, scheme: "http", targetPort: 8080) | ||
| .WithEndpoint(name: DurableTaskConstants.Scheduler.Emulator.Endpoints.Dashboard, scheme: "http", targetPort: 8082) | ||
| .WithAnnotation( |
There was a problem hiding this comment.
Missed that overload; updated.
There was a problem hiding this comment.
Also WithHttpEndpoint. Do we also need to add health checks?
There was a problem hiding this comment.
Updated that, too. I suppose health checks for the emulator could be useful, though I need to look at the API and examples. I'd be inclined to leave that as a separate, follow up PR.
src/Aspire.Hosting.Azure.Functions/DurableTask/DurableTaskSchedulerResource.cs
Outdated
Show resolved
Hide resolved
Signed-off-by: Phillip Hoff <phillip@orst.edu>
| .RunAsEmulator( | ||
| options => | ||
| { | ||
| options.WithDynamicTaskHubs(); |
There was a problem hiding this comment.
Why is this explicit call needed?
There was a problem hiding this comment.
Just as a demonstration of configuring options on the emulator. (Not every Aspire application will want to use dynamic task hub names.)
Signed-off-by: Phillip Hoff <phillip@orst.edu>
|
Closing in favor of replacement PR #13711. |
Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes #8926
Checklist
<remarks />and<code />elements on your triple slash comments?