Skip to content

Add sample Temporal integration for Aspire#127

Open
cecilphillip wants to merge 4 commits intomainfrom
cp-aspire
Open

Add sample Temporal integration for Aspire#127
cecilphillip wants to merge 4 commits intomainfrom
cp-aspire

Conversation

@cecilphillip
Copy link

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:

    • Local test server using Temporalio.Testing.WorkflowEnvironment
    • Container-based deployment using Docker
    • CLI-based server for environments without Docker
  • Temporal.Extensions.Aspire.Hosting library with:

    • Extension methods for adding Temporal resources to Aspire applications
    • Health check integration for Temporal connectivity
    • Automatic service discovery and environment variable injection
    • Resource lifecycle management (start/stop) via Aspire dashboard
    • Configurable options for ports, namespaces, search attributes, and dynamic config
  • Sample Aspire application demonstrating the integration:

    • TemporalioSamples.SampleAppHost - Aspire app host configuring Temporal resources
    • TemporalioSamples.SampleWorker - Worker service consuming workflows/activities
    • TemporalioSamples.SampleClient - Client triggering workflow execution
    • TemporalioSamples.SampleWorkflow - Simple workflow and activity definitions

@cecilphillip cecilphillip requested a review from a team as a code owner February 21, 2026 15:30
@CLAassistant
Copy link

CLAassistant commented Feb 21, 2026

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Comment on lines +7 to +10
var connectOptions = ClientEnvConfig.LoadClientConnectOptions();
Console.WriteLine("\nAttempting to connect client to temporal server...");

var client = await TemporalClient.ConnectAsync(connectOptions);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

@cretz cretz Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@cecilphillip cecilphillip requested a review from cretz February 23, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants