PostgreSQL
PostgreSQL is the recommended provider for most workloads. It supports both the Master database and Agent transport layers.
Install
dotnet add package JobMaster.Postgres
Configuration
builder.Services.AddJobMasterCluster(config =>
{
config.ClusterId("My-Cluster")
.UsePostgresForMaster("Host=...;Database=...;Username=...;Password=...");
config.AddAgentConnectionConfig("Postgres-1")
.UsePostgresForAgent("Host=...;Database=...;Username=...;Password=...");
});
Options
Table prefix
By default, JobMaster creates tables with the JM_ prefix. Override it via the tablePrefix parameter on UsePostgresForMaster/UsePostgresForAgent:
config.UsePostgresForMaster("Host=...;Database=...;Username=...;Password=...", tablePrefix: "myapp_jm_");
config.AddAgentConnectionConfig("Postgres-1")
.UsePostgresForAgent("Host=...;Database=...;Username=...;Password=...", tablePrefix: "myapp_agent_");
Also available through ConfigFromJson's connectionOptions: {"tablePrefix": "myapp_jm_"}.
UseSqlTablePrefixForMaster/UseSqlTablePrefixForAgentThose generic methods were deprecated in 0.0.11 and removed in 0.0.12: they applied regardless of which provider a connection actually used, which didn't make much sense (e.g. calling UseSqlTablePrefixForMaster on a RavenDB-master cluster). Use the tablePrefix parameter above instead.
Disable auto schema provisioning
By default, JobMaster creates and migrates its tables on startup. Disable this if you manage schema migrations yourself:
config.UsePostgresForMaster("...")
.DisableAutoProvisionSqlSchema();