TAF.BackgroundJobExecutors.SDK 1.0.0

dotnet add package TAF.BackgroundJobExecutors.SDK --version 1.0.0
                    
NuGet\Install-Package TAF.BackgroundJobExecutors.SDK -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TAF.BackgroundJobExecutors.SDK" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TAF.BackgroundJobExecutors.SDK" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="TAF.BackgroundJobExecutors.SDK" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TAF.BackgroundJobExecutors.SDK --version 1.0.0
                    
#r "nuget: TAF.BackgroundJobExecutors.SDK, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TAF.BackgroundJobExecutors.SDK@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TAF.BackgroundJobExecutors.SDK&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=TAF.BackgroundJobExecutors.SDK&version=1.0.0
                    
Install as a Cake Tool

TAF.BackgroundJobExecutors.SDK

Client for the TAF background job executor (scheduler) service. Create recurring and one-time jobs, and consume the event the scheduler publishes when they fire.

Install

<PackageReference Include="TAF.BackgroundJobExecutors.SDK" Version="1.0.0" />

Register

builder.Services.AddSchedulerClient(builder.Configuration);
{
  "SchedulerService": {
    "BaseUrl": "http://taf-backgroundjobexecutors",
    "TimeoutSeconds": 30
  },
  "ServiceAuth": { "ApiKey": "<shared service key>" }
}

ApiKey is read from the caller's own ServiceAuth:ApiKey and sent as X-API-Key, so token-less service-to-service calls pass the scheduler's auth gate.

Create a job

Jobs carry a callback describing what the scheduler does when they fire. Prefer EventCallbackRequest for TAF services — it publishes an event, so your service needs no publicly reachable endpoint.

var callback = new EventCallbackRequest
{
    EventType     = "ReportJobFired",
    TargetService = "Reports",
    JobData       = new Dictionary<string, object?> { ["scheduleId"] = scheduleId }
};

var result = await _scheduler.CreateRecurringJobAsync(
    "0 9 * * MON", callback, context, timezone: "Asia/Kolkata", ct);

if (result.IsSuccess)
    jobId = result.Value;   // keep this — it is how you delete the job later

One-time jobs take a UTC instant instead of a CRON expression:

await _scheduler.CreateOneTimeJobAsync(runAtUtc, callback, context, ct);

Deleting is idempotent enough to call during a re-registration:

await _scheduler.DeleteJobAsync(jobId, context, ct);

Keep JobData small — an identifier, not a snapshot. Re-read the rest from your own store when the job fires, or editing a schedule leaves stale data baked into a job that already exists.

Consume the fired event

Bind to the type in this package. Do not declare your own.

MassTransit derives the publish exchange from the message's namespace-qualified URN. A local class with identical properties binds to a different exchange, so the job registers cleanly, fires on time, and your handler is never called. There is no error to see.

using TAF_BackgroundJobExecutors_Contracts.Events;

public class ReportJobFiredHandler : IEventHandler<JobFiredEvent>
{
    public async Task HandleAsync(JobFiredEvent @event, BusContext context, CancellationToken ct)
    {
        // The event is broadcast to every service — filter to your own.
        if (!string.Equals(@event.TargetService, "Reports", StringComparison.OrdinalIgnoreCase))
            return;

        if (!@event.JobData.TryGetValue("scheduleId", out var raw)
            || !Guid.TryParse(raw?.ToString(), out var scheduleId))
            return;

        await _runner.RunAsync(scheduleId, context, ct);
    }
}

Handlers are discovered automatically by AddMessageBus(); no explicit registration.

JobFiredEvent carries EventType, TargetService, JobId, JobData, FiredAt, and the TenantId / AppId / EnvironmentId the job was created with.

BusContext extensions

For call sites that already carry a BusContext and nothing else:

serviceProvider.InitializeSchedulerExtensions();   // once, at startup
await context.CreateRecurringJobAsync(cron, callback);

Injecting ISchedulerClient is equivalent and preferred in new code.

Results

Every method returns OperationResult<T> — check IsSuccess before reading Value. Transport failures, non-success status codes and unparseable bodies all come back as a failed result with code SCHEDULER_UNAVAILABLE; nothing throws except OperationCanceledException.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 0 8/21/2026