Jobmaster .NET – tools like this are now easy to make with AI

Overview

JobMaster is a framework designed to manage and execute background tasks across distributed cluster. By decoupling coordination from execution, it enables horizontal scalability to adapt varying demands

Key Features

  • Distributed task orchestration across multiple nodes
  • Efficient separation of coordination logic task execution
  • Horizontal scalability to match workload intensity
  • Fault-tolerant design to maintain
  • Extensibility for custom types and scheduling policies

Getting Started

Visit the project repository for instructions usage, and documentation

https://github.com/hojs/jobmaster-net

Implementing a Job Handler

A Job Handler is a simple class that contains your background logic. JobMaster handles the instantiation and execution; you just focus on the code.

Basic Implementation

Create a class that implements the IJobHandler interface.

using JobMaster.Sdk.Abstractions.Models;

public class ProcessImageHandler : IJobHandler
{
    // The HandleAsync method is the entry point for the worker
    public async Task HandleAsync(JobContext job)
    {
        // 1. Retrieve data sent during scheduling
        var imageUrl = job.MsgData.GetStringValue("SourceUrl");
        var filterType = job.MsgData.GetStringValue("Filter");

        Console.WriteLine($"[Job {job.Id}] Processing image: {imageUrl} with {filterType}");

        // 2. Perform your business logic
        await Task.Delay(500); // Simulating work

        // 3. Handlers are async-ready
        await Task.CompletedTask;
    }
}

Schedule from a Minimal API

The IJobMasterScheduler is registered in the DI container. You can inject it into your endpoints to trigger background work instantly or at a specific time.

    app.MapPost("/schedule-job", async (IJobMasterScheduler jobScheduler) =>
    {
        // Build a fluent message data object
        var msg = WriteableMessageData.New().SetStringValue("Name", "John Doe");
    
        // Enqueue the job for immediate execution
        await jobScheduler.OnceNowAsync<HelloJobHandler>(msg);
        
        return Results.Accepted();
    
    }).WithOpenApi();

Documentation

  • Scheduling
    • One-off and recurring scheduling, IJobHandler, attributes and metadata
    • See: docs/Scheduling.md
  • Architecture Overview
    • Core concepts, planes (Orchestration & Durable Storage vs. Transport Layer), and standard assignment vs. high-speed SavePending shortcut flows.
    • See: docs/ArchitectureOverview.md