| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- using qdr.fnd.core.pqueue.Configuration;
- using qdr.fnd.core.pqueue.Enums;
- using qdr.fnd.core.pqueue.Process;
- using qdr.fnd.core.pqueue.Storages;
- using Quadarax.Foundation.Core.Data;
- using Quadarax.Foundation.Core.Logging;
- using Quadarax.Foundation.Core.Object;
- using Quadarax.Foundation.Core.Value.Generators;
- namespace qdr.fnd.core.pqueue
- {
- public class PsQueue : DisposableObject
- {
- #region *** Properties ***
- public string Name { get; }
- public bool IsRunning { get; private set; }
- public PsQueueConfiguration Configuration { get;}
- public event PsQueueStatusChangedEventHandler? ProcessItemStatusChanged;
- #endregion
- #region *** Private Fields ***
- private ILog _log;
- private TinyHash _hashGenerator;
- protected IPsQueueStorage? _storage;
- #endregion
- #region *** Constructors ***
- public PsQueue(string queueName, PsQueueConfiguration configuration,IPsQueueStorage storageProvider, ILogger logger)
- {
- _hashGenerator = new TinyHash(5);
- if (string.IsNullOrEmpty(queueName))
- queueName = "PSQUEUE" + _hashGenerator.NewId();
- Name = queueName;
- IsRunning = false;
- Configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
- _storage = storageProvider ?? throw new ArgumentNullException(nameof(storageProvider));
- _log = logger.GetLogger(queueName);
- }
- #endregion
- #region *** Public Operations ***
- public void Start()
- {
- //TODO: Implement Start
- }
- public void Stop()
- {
- //TODO: Implement Stop
- }
- public IPsQueueItem Queue(string owner, string ownerRef, IPsProcessProvider provider, IEnumerable<ITypedArgument> arguments, int priority,int initialAttepts, DateTime validFrom, DateTime? validTo)
- {
- }
- public IPsQueueItem Queue(string owner, string ownerRef, IPsProcessProvider provider, IEnumerable<ITypedArgument> arguments, int priority,int initialAttepts)
- {
- }
- public IPsQueueItem Queue(string owner, string ownerRef, IPsProcessProvider provider, IEnumerable<ITypedArgument> arguments)
- {
- }
- public bool Dequeue(string itemId, bool force)
- {
- }
- public IQueryable<IPsQueueItem> Query(string? owner, string? ownerRef, params Tuple<bool,PsStatusEnum>[] status)
- {
- }
- public IPsQueueItem? Get(string itemId)
- {
- }
- public bool Postpone(string itemId, TimeSpan postpone)
- {
- }
- public bool Reset(string itemId)
- {
- }
- public bool SetPriority(string itemId, int priority)
- {
- }
- public IEnumerable<IPsQueueItem> GetWorkingItems()
- {
- }
- #endregion
- #region *** Private Operations ***
- protected override void OnDisposing()
- {
- if(IsRunning)
- Stop();
- ProcessItemStatusChanged = null;
- _storage = null;
- //TODO: Implement OnDisposing
- }
- #endregion
- }
- }
|