QueDuler.Core 8.2.6

dotnet add package QueDuler.Core --version 8.2.6
NuGet\Install-Package QueDuler.Core -Version 8.2.6
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="QueDuler.Core" Version="8.2.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add QueDuler.Core --version 8.2.6
#r "nuget: QueDuler.Core, 8.2.6"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install QueDuler.Core as a Cake Addin
#addin nuget:?package=QueDuler.Core&version=8.2.6

// Install QueDuler.Core as a Cake Tool
#tool nuget:?package=QueDuler.Core&version=8.2.6

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 286 1/25/2024
8.2.5 187 1/23/2024
8.2.4 89 1/21/2024
8.2.3 97 1/21/2024
8.2.2 86 1/21/2024
8.2.1 83 1/21/2024
8.2.0 90 1/20/2024
8.1.4 239 12/19/2023
8.1.3 92 12/19/2023
8.1.2 103 12/19/2023
8.1.1 79 12/19/2023
8.1.0 116 12/19/2023
8.0.2 287 11/20/2023
8.0.1 112 11/20/2023
8.0.0 104 11/19/2023
7.0.4 256 11/21/2023
7.0.1 133 11/20/2023
7.0.0 126 11/20/2023
1.7.1 109 11/21/2023
1.6.0 101 11/20/2023
1.5.3 84 11/20/2023
1.5.2 101 11/20/2023
1.5.1 335 11/7/2023
1.5.0 210 10/21/2023
1.4.7 209 9/20/2023
1.4.6 366 9/5/2023
1.4.5 94 9/4/2023
1.4.4 202 8/27/2023
1.4.3 211 8/16/2023
1.4.2 153 8/9/2023
1.4.1 711 5/15/2023
1.4.0 2,808 1/3/2023
1.3.0 1,045 11/14/2022
1.2.2 661 11/2/2022
1.2.1 530 11/2/2022
1.2.0 832 10/15/2022
1.1.2 1,289 10/8/2022
1.1.1 685 10/2/2022
1.1.0 995 8/20/2022
1.0.9 2,727 4/6/2022
1.0.8 455 4/6/2022
1.0.0 766 3/5/2022