| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- using Quadarax.Foundation.Core.Business.Processor.Enums;
- namespace Quadarax.Foundation.Core.Business.Processor.Task;
- public interface ITaskItem : ITaskIdentifier, ITimeTracked
- {
- #region *** Properties ***
- /// <summary>
- /// Contains the affinity token which is used to identify owning/locking queue.
- /// </summary>
- IAffinityToken AffinityToken { get; }
- /// <summary>
- /// External reference of the task.
- /// </summary>
- public string Reference { get; }
- /// <summary>
- /// Status of the task.
- /// </summary>
- public ProcessStatusEnum Status { get; }
- /// <summary>
- /// Assembly qualified name of the provider class responsible to process task.
- /// </summary>
- public string ProviderClass { get; }
- /// <summary>
- /// Task priority value (0-maximal, 255-minimal / default 100).
- /// </summary>
- public byte Priority { get; }
- /// <summary>
- /// Time when task can be processed.
- /// </summary>
- public DateTime ProcessingValidFrom { get; }
- /// <summary>
- /// Time when task will be expired.
- /// </summary>
- public DateTime? ProcessingValidTo { get; }
- /// <summary>
- /// Decremental counter of attempts to try process task.
- /// </summary>
- public int AttemptsLeft { get; }
- /// <summary>
- /// Statistical timestamp when task begins to process.
- /// </summary>
- public DateTime StatStarted { get; }
- /// <summary>
- /// Statistical timestamp when task finished.
- /// </summary>
- public DateTime StatFinished { get; }
- /// <summary>
- /// Latest attempt duration
- /// </summary>
- public TimeSpan StatLastAttemptDuration { get; }
- #endregion
- #region *** Operations ***
- /// <summary>
- /// Schedules task to future and sets <see cref="Status"/> to <see cref="ProcessStatusEnum.Pending"/> (affects <see cref="ProcessingValidFrom"/> and <see cref="ProcessingValidTo"/>).
- /// <list type="bullet">
- /// <item><description>Allowed state: <see cref="ProcessStatusEnum.Pending"/>, <see cref="ProcessStatusEnum.Paused"/></description></item>
- /// <item><description>Set state to: <see cref="ProcessStatusEnum.Pending"/></description></item>
- /// </list>
- /// </summary>
- /// <param name="postponeInterval">Interval to shift to future.</param>
- /// <param name="reason">Reason message to postpone.</param>
- void Postpone(TimeSpan postponeInterval, string reason);
- void Stop(string reason);
- void Reset(string reason);
- #endregion
- }
|