https://github.com/dcarea/fabron
A distributed timer/job scheduler built on top of Project Orleans.
https://github.com/dcarea/fabron
background-jobs background-tasks cron-jobs distributed-cron distributed-timers job-scheduler orleans scheduled-jobs
Last synced: about 1 month ago
JSON representation
A distributed timer/job scheduler built on top of Project Orleans.
- Host: GitHub
- URL: https://github.com/dcarea/fabron
- Owner: DCArea
- License: mit
- Created: 2020-10-16T15:20:32.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-09-06T13:48:39.000Z (about 1 year ago)
- Last Synced: 2025-08-01T01:26:47.465Z (2 months ago)
- Topics: background-jobs, background-tasks, cron-jobs, distributed-cron, distributed-timers, job-scheduler, orleans, scheduled-jobs
- Language: C#
- Homepage:
- Size: 1000 KB
- Stars: 20
- Watchers: 4
- Forks: 3
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fabron
This is a distributed timer built on top of Project Orleans.
### How to use it
There are 3 types of timers:
* GenericTimer: fire once at the certain time.
* PeriodicTimer: fire repeatly with a time span.
* CronTimer: fire by following a cron schedule#### Define a fire router
```csharp
public class AnnotationBasedFireRouter : IFireRouter
{
private readonly IHttpDestinationHandler _http;public AnnotationBasedFireRouter(IHttpDestinationHandler http) => _http = http;
public bool Matches(FireEnvelop envelop)
{
var extensions = envelop.Extensions;
return extensions.ContainsKey("routing.fabron.io/destination");
}public Task DispatchAsync(FireEnvelop envelop)
{
var destination = envelop.Extensions["routing.fabron.io/destination"];
Guard.IsNotEmpty(destination, nameof(destination));
return destination.StartsWith("http")
? _http.SendAsync(new Uri(destination), envelop)
: ThrowHelper.ThrowArgumentOutOfRangeException(nameof(destination));
}
}
```#### Configure the server
```csharp
var server = builder.Host.UseFabronServer()
.AddFireRouter();
var client = builder.Host.UseFabronClient(cohosted: true);server
.ConfigureOrleans((ctx, siloBuilder) =>
{
// configure internal orleans server
})
```#### Schedule a timer
```csharp
await client.ScheduleCronTimer(
"A_Timer_Key",
new { SomeData = "To be delivered at firing" },
"0 0 7 * * *", // 7AM every day
extensions: new(){ { "callback_url": "http://call_this_url_at_firing" } });
```### Design Details
TBD