QueDuler.Core
7.0.4
See the version list below for details.
dotnet add package QueDuler.Core --version 7.0.4
NuGet\Install-Package QueDuler.Core -Version 7.0.4
<PackageReference Include="QueDuler.Core" Version="7.0.4" />
paket add QueDuler.Core --version 7.0.4
#r "nuget: QueDuler.Core, 7.0.4"
// Install QueDuler.Core as a Cake Addin #addin nuget:?package=QueDuler.Core&version=7.0.4 // Install QueDuler.Core as a Cake Tool #tool nuget:?package=QueDuler.Core&version=7.0.4
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 | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net7.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 | 900 | 1/25/2024 |
8.2.5 | 223 | 1/23/2024 |
8.2.4 | 131 | 1/21/2024 |
8.2.3 | 144 | 1/21/2024 |
8.2.2 | 129 | 1/21/2024 |
8.2.1 | 119 | 1/21/2024 |
8.2.0 | 139 | 1/20/2024 |
8.1.4 | 282 | 12/19/2023 |
8.1.3 | 134 | 12/19/2023 |
8.1.2 | 145 | 12/19/2023 |
8.1.1 | 119 | 12/19/2023 |
8.1.0 | 172 | 12/19/2023 |
8.0.2 | 347 | 11/20/2023 |
8.0.1 | 149 | 11/20/2023 |
8.0.0 | 136 | 11/19/2023 |
7.0.4 | 306 | 11/21/2023 |
7.0.1 | 179 | 11/20/2023 |
7.0.0 | 177 | 11/20/2023 |
1.7.1 | 134 | 11/21/2023 |
1.6.0 | 133 | 11/20/2023 |
1.5.3 | 112 | 11/20/2023 |
1.5.2 | 135 | 11/20/2023 |
1.5.1 | 396 | 11/7/2023 |
1.5.0 | 266 | 10/21/2023 |
1.4.7 | 251 | 9/20/2023 |
1.4.6 | 399 | 9/5/2023 |
1.4.5 | 129 | 9/4/2023 |
1.4.4 | 253 | 8/27/2023 |
1.4.3 | 250 | 8/16/2023 |
1.4.2 | 193 | 8/9/2023 |
1.4.1 | 756 | 5/15/2023 |
1.4.0 | 3,431 | 1/3/2023 |
1.3.0 | 1,101 | 11/14/2022 |
1.2.2 | 713 | 11/2/2022 |
1.2.1 | 569 | 11/2/2022 |
1.2.0 | 879 | 10/15/2022 |
1.1.2 | 1,331 | 10/8/2022 |
1.1.1 | 731 | 10/2/2022 |
1.1.0 | 1,035 | 8/20/2022 |
1.0.9 | 2,810 | 4/6/2022 |
1.0.8 | 483 | 4/6/2022 |
1.0.0 | 822 | 3/5/2022 |