#region ========================================================================= USING ===================================================================================== using Lumina.Domain.Core.BoundedContexts.SchedulingBoundedContext.ScheduledJobAggregate.ValueObjects; using System.Threading; using System.Threading.Tasks; #endregion namespace Lumina.Application.Common.Infrastructure.Scheduling; /// /// Interface for the service that schedules and executes the tasks of scheduled jobs. /// public interface IScheduledJobScheduler { /// /// Starts the execution cycle of the scheduled job identified by . /// /// The object representing the unique identifier of the scheduled job whose execution cycle is started. /// Cancellation token that can be used to stop the execution. /// A task that represents the asynchronous operation. Task StartCycleAsync(ScheduledJobId scheduledJobId, CancellationToken cancellationToken); /// /// Stops the execution cycle of the scheduled job identified by . /// /// The object representing the unique identifier of the scheduled job whose execution cycle is stopped. /// Cancellation token that can be used to stop the execution. /// A task that represents the asynchronous operation. Task StopCycleAsync(ScheduledJobId scheduledJobId, CancellationToken cancellationToken); /// /// Fires the task of the scheduled job identified by once, without affecting its execution cycle. /// /// The object representing the unique identifier of the scheduled job whose task is fired. /// Cancellation token that can be used to stop the execution. /// A task that represents the asynchronous operation. Task RunOnceAsync(ScheduledJobId scheduledJobId, CancellationToken cancellationToken); }