Extensions & helpers for setting up a Temporal resource in Aspire.
- C# 100%
| .forgejo/workflows | ||
| .idea/.idea.Byrone.Aspire.Temporal/.idea | ||
| Byrone.Aspire.Temporal | ||
| TemporalAppHost | ||
| .gitignore | ||
| Byrone.Aspire.Temporal.slnx | ||
| Directory.Build.props | ||
| icon.png | ||
| LICENSE.md | ||
| README.md | ||
Byrone.Aspire.Temporal
Extensions & helpers for setting up a Temporal resource in Aspire.
Usage
It's recommended to use the byrone2/temporal Docker image, as this will automatically handle setting up the PostgreSQL database and namespace creation.
using Byrone.Aspire.Hosting;
using Byrone.Aspire.Hosting.Temporal;
var builder = DistributedApplication.CreateBuilder(args);
var @namespace = "default";
// Add the Temporal resource with a PostgreSQL database.
// This will add a Docker container to the Aspire app, using the image 'byrone2/temporal'.
var temporal = builder.AddTemporalContainer(new TemporalContainerOptions
{
Name = "Temporal",
Namespaces = [@namespace],
PostgresName = "TemporalPostgres",
DatabaseName = "TemporalDatabase",
DatabaseVolumeName = "temporal_postgres",
});
// (optional) Add the Temporal UI container resource.
var temporalUi = builder.AddTemporalUiContainer(temporal, new TemporalUiContainerOptions
{
Name = "TemporalUi",
Tag = "latest",
DefaultNamespace = @namespace,
});
// Add your worker resource. This could be anything you'd like.
var worker = …;
// Adding a reference to the Temporal resource exposes a ConnectionString you can use.
worker.WithReference(temporal)
.WaitFor(temporal);
var app = …;
app.WithReference(temporal)
.WaitFor(temporal);