Skip to content

hugoj0s3/jobmaster-net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

234 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JobMaster

Distributed job orchestration engine for .NET. Built for horizontal scale, designed for resilience.

NuGet (pre)

📖 docs.jobmaster.hugoj0s3.dev


Quick Start

Standalone is the simplest way to run JobMaster. A single database connection handles coordination, job storage, and the transport layer — no additional brokers required.

Register in Program.cs

builder.Services.AddJobMasterCluster(config =>
{
    config.UseStandaloneCluster()
          .ClusterId("Local-Cluster-01")
          .UsePostgres("Host=localhost;Database=jobmaster_db;Username=postgres;Password=pwd")
          .AddWorker();
});

var app = builder.Build();

await app.Services.StartJobMasterRuntimeAsync();

Implement a Job Handler

public sealed class HelloJobHandler : IJobHandler
{
    public async Task HandleAsync(JobContext job)
    {
        var name = job.MsgData.TryGetStringValue("Name") ?? "World";
        Console.WriteLine($"Hello {name}");
        await Task.CompletedTask;
    }
}

Handlers are resolved from the .NET DI container — inject your services (repositories, HTTP clients, etc.) directly into the constructor.

Schedule a Job

IJobMasterScheduler is registered automatically. Inject it anywhere in your application.

app.MapPost("/schedule-job", async (IJobMasterScheduler jobScheduler) =>
{
    var msg = WriteableMessageData.New().SetStringValue("Name", "John Doe");

    await jobScheduler.OnceNowAsync<HelloJobHandler>(msg);

    return Results.Accepted();
}).WithOpenApi();

Core Concepts

JobMaster separates responsibilities into three layers:

  • Cluster Database (Master) — source of truth. Stores jobs, coordinates agents, and persists configuration.
  • Agents (Transport Layer) — ephemeral, high-speed buffers for in-flight jobs. Supports PostgreSQL, MySQL, SQL Server, and NATS JetStream.
  • Workers (Execution Layer) — claim and execute jobs using atomic locks. Scale horizontally with zero downtime.

Recurring Schedules

JobMaster supports recurrence expressions using the NaturalCron library.

// Fluent builder
var expression = NaturalCronBuilder.Every(1).Minutes().Build();
await jobScheduler.RecurringAsync<HelloJobHandler>(expression);

// Expression string
await jobScheduler.RecurringAsync<HelloJobHandler>(NaturalCronExprCompiler.TypeId, "every 1 minutes");

Dashboard & API

JobMaster ships a browser-based dashboard and a REST API for monitoring clusters, jobs, workers, buckets, and agent connections in real time.

dotnet add package JobMaster.Api
dotnet add package JobMaster.Dashboard

Both can run in a completely separate process from your workers — all they need is access to the master database.


Documentation

Full documentation is available at docs.jobmaster.hugoj0s3.dev:


Roadmap

See docs.jobmaster.hugoj0s3.dev/docs/roadmap.

About

Distributed background job orchestration for .NET built for seamless horizontal scaling and multi-provider support

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors