Queue jobs to the background no matter the size of the application you are building.
The Quidjibo client can be accessed via a static, or by injecting it as a dependency. Either way publishing your job is super simple.
public class BusinessLogic { public async Task DoLogic(CancellationToken cancellationToken) { // Use the static client when not using DI to inject the client await QuidjiboClient.Instance.PublishAsync(new DoWorkCommand(1,"hello world"), cancellationToken); } } public class BusinessLogic : IBusinessLogic { private readonly IQuidjiboClient _quidjiboClient; public BusinessLogic(IQuidjiboClient quidjiboClient) { _quidjiboClient = quidjiboClient; } public async Task DoLogic(CancellationToken cancellationToken) { // Use a constructor injected dependency. await _quidjiboClient.PublishAsync(new DoWorkCommand(1,"hello world"), cancellationToken); } }
Quidjibo will fire and manage tasks, but to safeguard against duplicate execution in case of interruption, keep your tasks reentrant.
Sometimes you want to know how a job is progressing. Quidjibo's progress tracker allows you to track a simple text and a simple numeric value as your job runs.
Using the correlationId provided when the job was published allows you to query the tracking details. Leverage this to build out progress bars or other visualization.