QueDuler.Core
8.1.1
See the version list below for details.
dotnet add package QueDuler.Core --version 8.1.1
NuGet\Install-Package QueDuler.Core -Version 8.1.1
<PackageReference Include="QueDuler.Core" Version="8.1.1" />
paket add QueDuler.Core --version 8.1.1
#r "nuget: QueDuler.Core, 8.1.1"
// Install QueDuler.Core as a Cake Addin #addin nuget:?package=QueDuler.Core&version=8.1.1 // Install QueDuler.Core as a Cake Tool #tool nuget:?package=QueDuler.Core&version=8.1.1
QueDuler
Queduler help you create, schedule and dispatch your jobs easily and fast. It partially implement Actor pattern but the focus is to manage Async jobs fast, EZ and light weight.
How to use
- you can use the extension method: AddQueduler() in name space: QueDuler.Helpers to register the dispatcher
services.AddQueduler(a => a.AddKafkaBroker(services, new Confluent.Kafka.ConsumerConfig
{
BootstrapServers = "78.47.21.107:9092",
GroupId = "aa",
AutoOffsetReset = Confluent.Kafka.AutoOffsetReset.Earliest,
}, topics: "jtopic_InsertOrderDraft").AddJobAssemblies(typeof(Program))
.AddInMemoryScheduler(services,new()
{
MaxInMemoryLogCount = 10,
TickTimeMillisecond = 1000,
}));
- you need to start the dispatcher so queduler starts it job! likely in startup after the build.
var dispatcher = serviceProvider.GetService<Dispatcher>();
dispatcher.Start(new CancellationToken { });
- while configuring provide the assemblies which contains the jobs which implimented IDispatchableJob and ISchedulableJob interfaces
Dispatching Concept
Invoking a Job(Act):
1- you need to sen a message to some well know path in your app, for example this code produce a message to a kafka topic:
var t = new ExtraData{
ID=1,
Name = "someName"
};
await _broker.ProduceAsync(new DispatchableJobArgument("SyncRedisWithDbJob", t).ToJson(), "jtopic_InsertOrderDraft", false);
2- DispatchableJobArgument is standard job argument, which should be provided it as the message body (if job is loosArgument it is not neccessary, we will get to it).
DispatchableJobArgument(string jobId, object argumentObject = null,
bool isBroadCast = false)
argobj could be any object ou want to have in msg and IsBroodcast if set to true will trigger all the jobs at the end of the path (JobId will not match).
Receiving the job Invokation req
1- you can dispatch jobs and trigger them with minimal effort, you only need to implement IBroker, or use some pre-implemented brokers like Queduler.Broker.Kafka.
2- every job should imple IDispatchableJob, have a unique jobid(the class name maybe), and DIspatch method.
every job will registered in DiContainer so you caninject services in job constructor
3- When dispatcher started, it appends a OnMessageReceivedEventHandler to IBroker.
4- Any time the message is equal to any jobid, the job will triggered instantly.
public class SampleJOb : IDispatchableJob
{
public string JobId => "SyncRedisWithDbJob";
public string JobPath => "jtopic_InsertOrderDraft";
public bool LoosArgument => true;
public async Task Dispatch(DispatchableJobArgument argument, object? originalMessage = null)
{
await Task.Delay(2000);
}
}
Every time a received message meet the criteria, the Dispatch method will be invoked.
1- JobId is unique for every job.
2- JobPath is an address that should be known, it could be a topic in kafka or a exchange in RQ.
3- LoosArgument: if true every message at the JobPath will be used as originalMessage parameter and u should cast it accordingly, if false then the message should be parsable to DispatchableJobArgument and then the JobId matches.
Scheduling Concept
- Same as IBroker, you can implement IScheduler or use pre-impl QueDuler.Scheduler.Hangfire
- every job should imple ISchedulableJob, have a unique jobid(the class name maybe), Cron expression and Do method.
every job will registered in DiContainer so you caninject services in job constructor
- When dispatcher starts, it schedule any job with Schedule methodin IScheduler interface using the cron expression.
- consider this job implementation:
- no more steps
if you decide to implement funtionalities yourself:
implement and inject these Interfaces:
public interface IScheduler
{
public Task Schedule(ISchedulableJob job);
}
public interface IBroker
{
public event Func<object, OnMessageReceivedArgs, Task> OnMessageReceived;
void PushMessage(OnMessageReceivedArgs message);
Task StartConsumingAsyn(CancellationToken cancellationToken);
}
contact me [exitchu@gmail.com]
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. |
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- Newtonsoft.Json (>= 13.0.3)
- System.Runtime (>= 4.3.1)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on QueDuler.Core:
Package | Downloads |
---|---|
QueDuler.Broker.Kafka
Package Description |
|
QueDuler.Scheduler.Hangfier
Package Description |
|
Soot.Net.Client
a notofication sender that support Rest and kafka for send Email & SMS |
|
QueDuler.Scheduler.InMemory
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.2.6 | 816 | 1/25/2024 |
8.2.5 | 219 | 1/23/2024 |
8.2.4 | 127 | 1/21/2024 |
8.2.3 | 138 | 1/21/2024 |
8.2.2 | 125 | 1/21/2024 |
8.2.1 | 115 | 1/21/2024 |
8.2.0 | 135 | 1/20/2024 |
8.1.4 | 278 | 12/19/2023 |
8.1.3 | 130 | 12/19/2023 |
8.1.2 | 141 | 12/19/2023 |
8.1.1 | 113 | 12/19/2023 |
8.1.0 | 168 | 12/19/2023 |
8.0.2 | 343 | 11/20/2023 |
8.0.1 | 145 | 11/20/2023 |
8.0.0 | 132 | 11/19/2023 |
7.0.4 | 302 | 11/21/2023 |
7.0.1 | 175 | 11/20/2023 |
7.0.0 | 173 | 11/20/2023 |
1.7.1 | 130 | 11/21/2023 |
1.6.0 | 129 | 11/20/2023 |
1.5.3 | 106 | 11/20/2023 |
1.5.2 | 131 | 11/20/2023 |
1.5.1 | 392 | 11/7/2023 |
1.5.0 | 262 | 10/21/2023 |
1.4.7 | 247 | 9/20/2023 |
1.4.6 | 395 | 9/5/2023 |
1.4.5 | 125 | 9/4/2023 |
1.4.4 | 249 | 8/27/2023 |
1.4.3 | 246 | 8/16/2023 |
1.4.2 | 189 | 8/9/2023 |
1.4.1 | 752 | 5/15/2023 |
1.4.0 | 3,346 | 1/3/2023 |
1.3.0 | 1,097 | 11/14/2022 |
1.2.2 | 709 | 11/2/2022 |
1.2.1 | 565 | 11/2/2022 |
1.2.0 | 875 | 10/15/2022 |
1.1.2 | 1,327 | 10/8/2022 |
1.1.1 | 727 | 10/2/2022 |
1.1.0 | 1,031 | 8/20/2022 |
1.0.9 | 2,806 | 4/6/2022 |
1.0.8 | 479 | 4/6/2022 |
1.0.0 | 818 | 3/5/2022 |