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
<PackageReference Include="TAF.BackgroundJobExecutors.SDK" Version="1.0.0" />
<PackageVersion Include="TAF.BackgroundJobExecutors.SDK" Version="1.0.0" />
<PackageReference Include="TAF.BackgroundJobExecutors.SDK" />
paket add TAF.BackgroundJobExecutors.SDK --version 1.0.0
#r "nuget: TAF.BackgroundJobExecutors.SDK, 1.0.0"
#:package TAF.BackgroundJobExecutors.SDK@1.0.0
#addin nuget:?package=TAF.BackgroundJobExecutors.SDK&version=1.0.0
#tool nuget:?package=TAF.BackgroundJobExecutors.SDK&version=1.0.0
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 | Versions 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. |
-
net8.0
- Microsoft.Extensions.Configuration (>= 9.0.8)
- Microsoft.Extensions.DependencyInjection (>= 9.0.8)
- Microsoft.Extensions.Http (>= 9.0.8)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 9.0.8)
- TAF.Infra.Contract (>= 1.11.5)
- TAF.Infra.MassTransit (>= 2.2.21)
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 |