Add sample Temporal integration for Aspire#127
Conversation
|
|
src/AspireIntegrations/TemporalioSamples.SampleAppHost/AppHost.cs
Outdated
Show resolved
Hide resolved
| var connectOptions = ClientEnvConfig.LoadClientConnectOptions(); | ||
| Console.WriteLine("\nAttempting to connect client to temporal server..."); | ||
|
|
||
| var client = await TemporalClient.ConnectAsync(connectOptions); |
There was a problem hiding this comment.
Aren't you supposed to be able to use Aspire to get client connectivity information too? Even if it is powered by env vars under the hood, one might expect a type-safe Aspire way to get a client or client options for the given "temporal" reference from other project.
There was a problem hiding this comment.
Aspire only does that through environment variables. There isn't anything type-safe configuration support specifically from aspire. Typically library authors would create their own using Microsoft.Extensions.Configuration bindings
There was a problem hiding this comment.
I mean from a caller POV. For instance, stuff like https://aspire.dev/integrations/databases/postgres/postgres-get-started/?lang=csharp#use-the-integration-in-client-projects. I would expect that you can just put a client on the DI container w/ a single Aspire helper. Sure you can always still manually create clients.
There was a problem hiding this comment.
I mean we could create an extension method that makes that a little nicer, but that would be a client specific library/package. From an aspire API perspective, they just inject configuration properties that get consumed .
There was a problem hiding this comment.
They inject configuration properties for those not wanting to use the helper, but they also provide a helper. I figure the nice aspect of "Aspire helper to make server, Aspire helper to make client" is valuable even though they can use the env vars directly of course, same as Postgres there.
Co-authored-by: Chad Retz <chad@temporal.io>
What was changed
This PR adds comprehensive .NET Aspire integration for Temporal, including:
Custom Aspire resource definitions for Temporal server deployment with three deployment models:
Temporalio.Testing.WorkflowEnvironmentTemporal.Extensions.Aspire.Hostinglibrary with:Sample Aspire application demonstrating the integration:
TemporalioSamples.SampleAppHost- Aspire app host configuring Temporal resourcesTemporalioSamples.SampleWorker- Worker service consuming workflows/activitiesTemporalioSamples.SampleClient- Client triggering workflow executionTemporalioSamples.SampleWorkflow- Simple workflow and activity definitions