using Quadarax.Foundation.Core.Business.Processor.Enums; using Quadarax.Foundation.Core.Business.Processor.Exceptons; namespace Quadarax.Foundation.Core.Business.Processor.Task; public interface ITaskItem : ITaskIdentifier, ITimeTracked { #region *** Properties *** /// /// Contains the affinity token which is used to identify owning/locking queue. /// IAffinityToken AffinityToken { get; } /// /// External reference of the task. /// public string Reference { get; } /// /// Status of the task. /// public ProcessStatusEnum Status { get; } /// /// Assembly qualified name of the provider class responsible to process task. /// public string ProviderClass { get; } /// /// Task priority value (0-maximal, 255-minimal / default 100). /// public byte Priority { get; } /// /// Time when task can be processed. /// public DateTime ProcessingValidFrom { get; } /// /// Time when task will be expired. /// public DateTime? ProcessingValidTo { get; } /// /// Decremental counter of attempts to try process task. /// public int AttemptsLeft { get; } /// /// Statistical timestamp when task begins to process. /// public DateTime StatStarted { get; } /// /// Statistical timestamp when task finished. /// public DateTime StatFinished { get; } /// /// Latest attempt duration /// public TimeSpan StatLastAttemptDuration { get; } #endregion #region *** Operations *** /// /// Re-Schedules inactive task to future and sets to (affects and ). /// /// Allowed state: , /// Set state to: /// /// When task state is invalid for operation. /// /// Interval to shift to future. /// Reason message to postpone. void Postpone(TimeSpan postponeInterval, string reason); /// /// Stops running task and sets to or /// or (target status is depends on input arguments).. /// /// Allowed state: /// Set state to: or or /// /// When task state is invalid for operation. /// /// Reason message to stop. /// If true, then will be set to otherwise to or . /// If true, then will be set to otherwise to . void Stop(string reason, bool willPause = true, bool willFail = false); /// /// Resets task to initial state and sets to . /// Uses current validity to re-calculate and to now + . /// /// Reason to reset task. /// Postpone current validity from now. void Reset(string reason, TimeSpan postponeValid); #endregion }