Cogito.MassTransit.Scheduler
3.1.0
dotnet add package Cogito.MassTransit.Scheduler --version 3.1.0
NuGet\Install-Package Cogito.MassTransit.Scheduler -Version 3.1.0
<PackageReference Include="Cogito.MassTransit.Scheduler" Version="3.1.0" />
<PackageVersion Include="Cogito.MassTransit.Scheduler" Version="3.1.0" />
<PackageReference Include="Cogito.MassTransit.Scheduler" />
paket add Cogito.MassTransit.Scheduler --version 3.1.0
#r "nuget: Cogito.MassTransit.Scheduler, 3.1.0"
#:package Cogito.MassTransit.Scheduler@3.1.0
#addin nuget:?package=Cogito.MassTransit.Scheduler&version=3.1.0
#tool nuget:?package=Cogito.MassTransit.Scheduler&version=3.1.0
Cogito.MassTransit.Scheduler
Publishes a message on a fixed period, so recurring work is a message rather than a timer.
Why
Recurring work usually starts as a timer in one process, which then has to be prevented from running in the other instances. Publishing on a schedule instead means the work is an ordinary consumer: competing consumers handle it once, and it retries, logs and scales like everything else on the bus.
Install
This package holds the schedule and the messages. Install it with the package for the scheduler that keeps the schedule:
dotnet add package Cogito.MassTransit.Scheduler.Quartz
or
dotnet add package Cogito.MassTransit.Scheduler.Hangfire
Use
Select the scheduler when adding the periodic job scheduler:
services.AddPeriodicJobScheduler(c => c.UseQuartz());
or
services.AddPeriodicJobScheduler(c => c.UseHangfire());
A message is then published on each of the intervals in PeriodicInterval: PT1M, PT5M,
PT15M, PT30M, PT1H, PT2H, PT6H, PT12H and P1D, aligned to midnight UTC. Consume the
message type for the interval you need:
public class Cleanup : IConsumer<PT15M>
{
public Task Consume(ConsumeContext<PT15M> context) => ...;
}
Each message carries its interval and its fire times. It is published non-durably, and expires after its interval, by when the next is due.
The periodic messages are published directly, not through MassTransit's recurring message scheduling. That fixes a message's time to live when the schedule is created rather than each time it fires, and cannot carry the fire times in the message.
Upgrading from 2.x
The scheduler no longer defaults to Quartz. Add Cogito.MassTransit.Scheduler.Quartz, and replace
AddPeriodicJobScheduler() with AddPeriodicJobScheduler(c => c.UseQuartz()).
License
MIT.
| 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. |
| .NET Framework | net472 is compatible. net48 was computed. net481 was computed. |
-
.NETFramework 4.7.2
- Cogito.MassTransit (>= 3.1.0)
-
net8.0
- Cogito.MassTransit (>= 3.1.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Cogito.MassTransit.Scheduler:
| Package | Downloads |
|---|---|
|
Cogito.MassTransit.Scheduler.Autofac
Provides an Autofac module to register the Scheduler components within an application. |
|
|
Cogito.MassTransit.Scheduler.Hangfire
Publishes MassTransit periodic messages on a schedule kept by Hangfire. |
|
|
Cogito.MassTransit.Scheduler.Quartz
Publishes MassTransit periodic messages on a schedule kept by Quartz. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.1.0 | 155 | 10/15/2026 |
| 3.0.0 | 121 | 10/10/2026 |
| 3.0.0-pre.14 | 60 | 10/10/2026 |
| 2.3.7 | 128 | 9/14/2026 |
| 2.3.6 | 115 | 9/14/2026 |
| 2.3.5 | 121 | 9/10/2026 |
| 2.3.4 | 1,930 | 5/3/2026 |
| 2.3.3 | 147 | 5/3/2026 |
| 2.3.2 | 155 | 5/3/2026 |
| 2.3.1 | 143 | 5/3/2026 |
| 2.3.0 | 143 | 5/3/2026 |
| 2.2.0 | 148 | 5/3/2026 |
| 2.0.0 | 1,123 | 3/3/2025 |
| 1.0.34 | 2,643 | 11/29/2023 |
| 1.0.33 | 282 | 11/29/2023 |
| 1.0.31 | 385 | 11/16/2023 |
| 1.0.26 | 300 | 11/7/2023 |
| 1.0.25 | 1,360 | 9/4/2022 |
| 1.0.24 | 1,018 | 6/12/2022 |
| 1.0.23 | 1,010 | 5/17/2022 |