DurableTask.PostgreSQL is a PostgreSQL-backed storage provider for the
Durable Task Framework (DTFx),
focused on the standalone runtime scenario.
This repository follows the same overall direction as microsoft/durabletask-mssql, but targets PostgreSQL and currently concentrates on standalone DTFx support.
- PostgreSQL portability: run on local environments, managed cloud PostgreSQL services, or self-hosted clusters.
- Data ownership: orchestration runtime data lives in your database and can be managed with your existing backup and governance processes.
- Operational visibility: SQL scripts and schema are part of this repository, making runtime behavior easier to inspect and operate.
| Package | Description |
|---|---|
DurableTask.PostgreSQL |
Standalone DTFx provider for PostgreSQL |
Project file:
src/DurableTask.PostgreSQL/DurableTask.PostgreSQL.csproj
- Standalone DTFx backend (
IOrchestrationServiceandIOrchestrationServiceClient) - PostgreSQL schema + logic scripts shipped with the package
- Integration-test coverage for core orchestration flows
This is a port in progress toward parity with the microsoft/durabletask-mssql 1.x reference. To set expectations clearly:
Supported and integration-tested:
- Create / get-state / get-history for orchestrations
- Activity execution (schedule + complete)
- Durable timers
- ContinueAsNew (orchestration loops with a new execution id)
- Sub-orchestration (nested orchestrations with result propagation)
- External events raised via the client, with the orchestrator waiting via the
OnEventpattern - Purge by filter and by instance id
- Orchestration query (
GetOrchestrationWithQueryAsync) - Multi-tenancy via task hubs (
TaskHubName) - Concurrent-deploy safety (schema creation retries on contention)
Known limitations (not yet at parity):
- Durable entities: not implemented (the MSSQL provider's entity feature has no PostgreSQL equivalent yet). Tracked for 1.1.0.
- Schema migrations: forward migrations are supported. The baseline
(
schema.postgresql.sql) is applied idempotently for fresh installs; subsequent upgrades are applied from embeddedScripts/migrations/migration-{semver}.postgresql.sqlresources in semantic-version order, each recorded indt.versions. Migrations must use idempotent DDL (ADD COLUMN IF NOT EXISTS,CREATE TYPE IF NOT EXISTS, etc.). - Tags:
OrchestrationState.Tagsis a non-null empty dictionary but tags are not persisted (no schema column). - Least-privilege role: no
dt_runtime-style role/GRANTmodel yet; connect with a user that can create the schema.
If any of the above is a blocker for your use case, please open an issue.
Install package:
dotnet add package DurableTask.PostgreSQLRegister with DI:
using DurableTask.PostgreSQL;
using Microsoft.Extensions.DependencyInjection;
var services = new ServiceCollection();
services.AddDurableTaskPostgreSql(new PostgreSqlOrchestrationServiceSettings
{
ConnectionString = "Host=localhost;Port=5433;Database=durabletask;Username=postgres;Password=postgres",
SchemaName = "dt",
TaskHubName = "sample-hub",
AutoDeploySchema = true
});The provider ships SQL scripts at:
src/DurableTask.PostgreSQL/Scripts/schema.postgresql.sqlsrc/DurableTask.PostgreSQL/Scripts/logic.postgresql.sql
These scripts are also packed in NuGet as content files.
Restore/build:
dotnet restore src/DurableTask.PostgreSQL/DurableTask.PostgreSQL.csproj
dotnet build src/DurableTask.PostgreSQL/DurableTask.PostgreSQL.csproj -c ReleaseRun tests:
dotnet test tests/DurableTask.PostgreSQL.Tests/DurableTask.PostgreSQL.Tests.csproj -c ReleaseBy default, integration tests use:
Host=localhost;Port=5433;Database=durabletask;Username=postgres;Password=postgres
Or set POSTGRES_CONNECTION_STRING to override.
A minimal consumer exists in:
samples/ConsumerApp
Run it with:
dotnet run --project samples/ConsumerApp/ConsumerApp.csprojNuGet publishing is automated by GitHub Actions in
.github/workflows/publish-nuget.yml.
Triggers:
- Pull Request and Push (main/vnext/desenv): build + pack validation
- Tag push
v*: build + publish to NuGet.org - Manual (
workflow_dispatch): optional publish whenpublish=true
For trusted publishing, configure:
- NuGet.org trusted publisher for this GitHub repository/workflow
- GitHub secret
NUGET_ORG_USERNAMEwith the owner username at NuGet.org
Contributions are welcome. Open an issue to discuss proposals and behavior changes before large PRs.
Please review Code of Conduct before contributing.
MIT. See LICENSE.