Răsfoiți Sursa

add qdr.fnd.core.pqueue initial version

Dalibor Votruba 2 ani în urmă
părinte
comite
4a9e2e6ac6

+ 6 - 0
qdr.fnd.core.pqueue/Configuration/PsQueueConfiguration.cs

@@ -0,0 +1,6 @@
+namespace qdr.fnd.core.pqueue.Configuration
+{
+    public class PsQueueConfiguration
+    {
+    }
+}

+ 26 - 0
qdr.fnd.core.pqueue/Delegates.cs

@@ -0,0 +1,26 @@
+using qdr.fnd.core.pqueue.Enums;
+
+namespace qdr.fnd.core.pqueue
+{
+    public delegate void PsQueueStatusChangedEventHandler(IPsQueue sender, PsQueueStatusChangedEventArgs e);
+
+    public class PsQueueStatusChangedEventArgs : EventArgs
+    {
+        
+        #region *** Properties ***
+        public string ProcessQueueItemId { get; set; }
+        public PsStatusEnum CurrentStatus { get; set; }
+        public bool CurrentIsStatusTransient { get; set; }
+        public PsStatusEnum PreviousStatus { get; set; }
+        public bool PreviousIsStatusTransient { get; set; }
+        #endregion
+
+        #region *** Constructors ***
+        public PsQueueStatusChangedEventArgs(string processQueueItemId)
+        {
+            ProcessQueueItemId = processQueueItemId;
+        }
+        #endregion
+
+    }
+}

+ 14 - 0
qdr.fnd.core.pqueue/Enums/PsStatusEnum.cs

@@ -0,0 +1,14 @@
+namespace qdr.fnd.core.pqueue.Enums
+{
+    public enum PsStatusEnum : int
+    {
+        New = 0,
+        Pending = 1,
+        Started = 2,
+        Paused = 3,
+        Stopped = 4,
+        DoneOk = 5,
+        DoneFailed = 6,
+        Deleted = 7
+    }
+}

+ 14 - 0
qdr.fnd.core.pqueue/IPsQueue.cs

@@ -0,0 +1,14 @@
+namespace qdr.fnd.core.pqueue
+{
+    public interface IPsQueue : IDisposable
+    {
+        #region *** Properties ***
+        bool IsRunning { get; }
+        #endregion
+
+        #region *** Operations ***
+        void Start();
+        void Stop();
+        #endregion
+    }
+}

+ 28 - 0
qdr.fnd.core.pqueue/IPsQueueItem.cs

@@ -0,0 +1,28 @@
+using qdr.fnd.core.pqueue.Enums;
+using Quadarax.Foundation.Core.Data;
+
+namespace qdr.fnd.core.pqueue
+{
+    public interface IPsQueueItem
+    {
+        #region *** Properties ***
+        string Id { get; }
+        public string Owner { get; }
+        public string OwnerRef { get; }
+        int Priority { get; }
+        DateTime ValidFrom { get; }
+        DateTime? ValidTo { get; }
+        DateTime Created { get; }
+        DateTime? Started { get; }
+        DateTime? Finished { get; }
+        PsStatusEnum Status { get; }
+        bool IsStatusTransient { get; }
+        int AttemptsLeft { get; }
+        int AtteptsInitial { get; }
+        string ProcessProviderClass { get; }
+        IEnumerable<ITypedArgument> Arguments { get; }
+        IEnumerable<IError> Log { get; }
+        IEnumerable<PsStatusHistory> StatusJournal { get;}
+        #endregion
+    }
+}

+ 11 - 0
qdr.fnd.core.pqueue/Process/IPsProcessProvider.cs

@@ -0,0 +1,11 @@
+using Quadarax.Foundation.Core.Data;
+
+namespace qdr.fnd.core.pqueue.Process
+{
+    public interface IPsProcessProvider
+    {
+        void Validate();
+        void Start();
+        void Stop();
+    }
+}

+ 2 - 0
qdr.fnd.core.pqueue/Program.cs

@@ -0,0 +1,2 @@
+// See https://aka.ms/new-console-template for more information
+Console.WriteLine("Hello, World!");

+ 118 - 0
qdr.fnd.core.pqueue/PsQueue.cs

@@ -0,0 +1,118 @@
+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
+    }
+}

+ 21 - 0
qdr.fnd.core.pqueue/PsStatusHistory.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using qdr.fnd.core.pqueue.Enums;
+
+namespace qdr.fnd.core.pqueue
+{
+    public class PsStatusHistory
+    {
+        #region *** Properties ***
+        public DateTime Created { get; }
+        public PsStatusEnum PreviousStatus { get; }
+        public bool PreviousIsStatusTransient { get; }
+        public string? Description { get; }
+        #endregion
+        #region *** Constructors ***
+        #endregion
+    }
+}

+ 186 - 0
qdr.fnd.core.pqueue/Storages/BaseStorageProvider.cs

@@ -0,0 +1,186 @@
+using System.Collections.Concurrent;
+using qdr.fnd.core.pqueue.Enums;
+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.Storages
+{
+    public abstract class BaseStorageProvider : DisposableObject, IPsQueueStorage
+    {
+
+        #region *** Properties ***
+        #endregion
+
+        #region *** Private Fields ***
+
+        private IDictionary<string, IList<IPsQueueItem>> _tranScopes =
+            new ConcurrentDictionary<string, IList<IPsQueueItem>>();
+
+        private ILog? _log;
+        private IIdGenerator<string>? _tranGenerator;
+
+        #endregion
+
+        #region *** Constructors ***
+        protected BaseStorageProvider(ILogger? logger)
+        {
+            _log = logger?.GetLogger(GetType().Name);
+            _tranGenerator = new TinyHash(10);
+        }
+
+        #endregion
+
+        #region *** Operations ***
+        #region **** Transaction ****
+
+        /// <inheritdoc />
+        public string CreateTransaction()
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <inheritdoc />
+        public void CommitTransaction(string transactionId)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <inheritdoc />
+        public void RollbackTransaction(string transactionId)
+        {
+            throw new NotImplementedException();
+        }
+        #endregion
+
+        /// <inheritdoc />
+        public string CreateItem(string transactionId, string owner, string ownerRef, string providerClass, DateTime? created)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <inheritdoc />
+        public void DeleteItem(string transactionId, string itemId)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <inheritdoc />
+        public void UpdateItemPriority(string transactionId, string itemId, int priority)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <inheritdoc />
+        public void UpdateItemValidity(string transactionId, string itemId, DateTime validForm, DateTime? validTo)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <inheritdoc />
+        public void UpdateItemStatus(string transactionId, string itemId, PsStatusEnum? status, bool isTransient)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <inheritdoc />
+        public void UpdateItemAttempts(string transactionId, string itemId, int attemptsLeft)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <inheritdoc />
+        public void UpdateItemStarted(string transactionId, string itemId, DateTime? started)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <inheritdoc />
+        public void UpdateItemFinished(string transactionId, string itemId, DateTime? finished)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <inheritdoc />
+        public void CreateItemAttribute(string transactionId, string itemId, string name, string? value, string valueTypeClass,
+            bool isOutput)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <inheritdoc />
+        public void UpdateItemAttribute(string transactionId, string itemId, string name, string value)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <inheritdoc />
+        public void DeleteItemAttribute(string transactionId, string itemId, string name)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <inheritdoc />
+        public void AppendLog(string transactionId, string itemId, string message, int code, ErrorLevelEnum messageType)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <inheritdoc />
+        public void AppendStatusJournal(string transactionId, string itemId, PsStatusEnum status, bool isTransient, string message)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <inheritdoc />
+        public IQueryable<IPsQueueItem> Query(string? owner, string? ownerRef, params Tuple<bool, PsStatusEnum>[] status)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <inheritdoc />
+        public IPsQueueItem GetItem(string? transactionId, string itemId)
+        {
+            throw new NotImplementedException();
+        }
+
+        #endregion
+        #region *** Private Operations ***
+
+        #region Overrides of DisposableObject
+
+        /// <inheritdoc />
+        protected override void OnDisposing()
+        {
+            // rollback all transactions
+            foreach (var tranId in _tranScopes.Keys.ToArray())
+            {
+                if(_tranScopes.ContainsKey(tranId))
+                    RollbackTransaction(tranId);
+            }
+            // cleanup rest of transaction scopes
+            _tranScopes.Clear();
+
+            // cleanup logger
+            _log = null;
+
+            // cleanup id generator
+            _tranGenerator = null;
+        }
+
+        protected void Log(LogSeverityEnum severity, string? transactionId, string itemId, string message, Exception? ex = null)
+        {
+            if (!string.IsNullOrWhiteSpace(transactionId))
+                message = $"[TRX: {transactionId}; ID: {itemId}] {message}";
+            _log?.Log(severity, message, ex);
+        }
+        protected void Log(LogSeverityEnum severity, string message, Exception? ex = null)
+        {
+            Log(severity, null, string.Empty, message, ex);
+        }
+        #endregion
+
+        #endregion
+    }
+}

+ 245 - 0
qdr.fnd.core.pqueue/Storages/IPsQueueStorage.cs

@@ -0,0 +1,245 @@
+using qdr.fnd.core.pqueue.Enums;
+using Quadarax.Foundation.Core.Data;
+
+namespace qdr.fnd.core.pqueue.Storages
+{
+    /// <summary>
+    /// PsQueue persistence storage interface. Manipulates with <see cref="IPsQueueItem"/> entities.
+    /// <remarks>
+    /// Has no any business logic. Just a storage interface.
+    /// Throws directly exceptions if something goes wrong.
+    /// </remarks>
+    /// </summary>
+    public interface IPsQueueStorage : IDisposable
+    {
+        #region *** Operations ***
+
+        #region **** Transactions ****
+        /// <summary>
+        /// Creates a new transaction and returns its id
+        /// </summary>
+        /// <returns>Transaction identifier</returns>
+        public string CreateTransaction();
+        /// <summary>
+        /// Commits all changes on the transaction specified by the <paramref name="transactionId"/> and closes transaction.
+        /// <remarks>
+        /// If <paramref name="transactionId"/> not exists, the method should throw an exception.
+        /// </remarks>
+        /// </summary>
+        /// <param name="transactionId">Transaction identifier</param>
+        public void CommitTransaction(string transactionId);
+        /// <summary>
+        /// Rollbacks all changes on the transaction specified by the <paramref name="transactionId"/> and closes transaction.
+        /// <remarks>
+        /// If <paramref name="transactionId"/> not exists, the method should throw an exception.
+        /// </remarks>
+        /// </summary>
+        /// <param name="transactionId">Transaction identifier</param>
+        public void RollbackTransaction(string transactionId);
+        #endregion
+        
+        #region **** Items ****
+        /// <summary>
+        /// Creates a new item in the queue storage and returns its identifier.
+        /// <remarks>
+        /// If <paramref name="transactionId"/> not exists, the method should throw an exception.
+        /// </remarks>
+        /// </summary>
+        /// <param name="transactionId">Transaction identifier generated by <see cref="CreateTransaction"/> operation.</param>
+        /// <param name="owner">Owner identifier</param>
+        /// <param name="ownerRef">Owner reference identifier</param>
+        /// <param name="providerClass">Process provider qualified type name</param>
+        /// <param name="created">Timestamp when record will be created. If null use current datetime.</param>
+        /// <returns>Item identifier.</returns>
+        public string CreateItem(string transactionId, string owner, string ownerRef, string providerClass, DateTime? created);
+        /// <summary>
+        /// Deletes (force) the item (and all related entities) specified by the <paramref name="itemId"/> no matter what status item has.
+        /// <remarks>
+        /// If <paramref name="transactionId"/> not exists, the method should throw an exception.
+        /// If <paramref name="itemId"/> not exists, the method should throw an exception.
+        /// </remarks>
+        /// </summary>
+        /// <param name="transactionId">Transaction identifier generated by <see cref="CreateTransaction"/> operation.</param>
+        /// <param name="itemId">Item identifier.</param>
+        public void DeleteItem(string transactionId, string itemId);
+        /// <summary>
+        /// Updates the priority of the item specified by the <paramref name="itemId"/>.
+        /// <remarks>
+        /// If <paramref name="transactionId"/> not exists, the method should throw an exception.
+        /// If <paramref name="itemId"/> not exists, the method should throw an exception.
+        /// </remarks>
+        /// </summary>
+        /// <param name="transactionId">Transaction identifier generated by <see cref="CreateTransaction"/> operation.</param>
+        /// <param name="itemId">Item identifier.</param>
+        /// <param name="priority">Process priority value.</param>
+        public void UpdateItemPriority(string transactionId, string itemId, int priority);
+        
+        /// <summary>
+        /// Updates the validity of the item specified by the <paramref name="itemId"/>.
+        /// <remarks>
+        /// If <paramref name="transactionId"/> not exists, the method should throw an exception.
+        /// If <paramref name="itemId"/> not exists, the method should throw an exception.
+        /// </remarks>
+        /// </summary>
+        /// <param name="transactionId">Transaction identifier generated by <see cref="CreateTransaction"/> operation.</param>
+        /// <param name="itemId">Item identifier.</param>
+        /// <param name="validForm">Timestamp for validFrom value.</param>
+        /// <param name="validTo">Timespamp for validTo value.</param>
+        public void UpdateItemValidity(string transactionId, string itemId, DateTime validForm, DateTime? validTo);
+        
+        /// <summary>
+        /// Updates the status of the item specified by the <paramref name="itemId"/>. Doesn't affects the status journal or logs.
+        /// <remarks>
+        /// If <paramref name="transactionId"/> not exists, the method should throw an exception.
+        /// If <paramref name="itemId"/> not exists, the method should throw an exception.
+        /// Doesn't validate the status transitions. Force update.
+        /// </remarks>
+        /// </summary>
+        /// <param name="transactionId">Transaction identifier generated by <see cref="CreateTransaction"/> operation.</param>
+        /// <param name="itemId">Item identifier.</param>
+        /// <param name="status">New item status. If null status will be kept.</param>
+        /// <param name="isTransient">New transient flag.</param>
+        public void UpdateItemStatus(string transactionId, string itemId, PsStatusEnum? status, bool isTransient);
+        
+        /// <summary>
+        /// Updates the attempts left value of the item specified by the <paramref name="itemId"/>.
+        /// <remarks>
+        /// If <paramref name="transactionId"/> not exists, the method should throw an exception.
+        /// If <paramref name="itemId"/> not exists, the method should throw an exception.
+        /// Doesn't validate attempts counter. Force update.
+        /// </remarks>
+        /// </summary>
+        /// <param name="transactionId">Transaction identifier generated by <see cref="CreateTransaction"/> operation.</param>
+        /// <param name="itemId">Item identifier.</param>
+        /// <param name="attemptsLeft">New attempt value.</param>
+        public void UpdateItemAttempts(string transactionId, string itemId, int attemptsLeft);
+        
+        /// <summary>
+        /// Updates the process started timestamp of the item specified by the <paramref name="itemId"/>.
+        /// <remarks>
+        /// If <paramref name="transactionId"/> not exists, the method should throw an exception.
+        /// If <paramref name="itemId"/> not exists, the method should throw an exception.
+        /// </remarks>
+        /// </summary>
+        /// <param name="transactionId">Transaction identifier generated by <see cref="CreateTransaction"/> operation.</param>
+        /// <param name="itemId">Item identifier.</param>
+        /// <param name="started">New timestamp value or null.</param>
+        public void UpdateItemStarted(string transactionId, string itemId, DateTime? started);
+        
+        /// <summary>
+        /// Updates the process finished timestamp of the item specified by the <paramref name="itemId"/>.
+        /// <remarks>
+        /// If <paramref name="transactionId"/> not exists, the method should throw an exception.
+        /// If <paramref name="itemId"/> not exists, the method should throw an exception.
+        /// </remarks>
+        /// </summary>
+        /// <param name="transactionId">Transaction identifier generated by <see cref="CreateTransaction"/> operation.</param>
+        /// <param name="itemId">Item identifier.</param>
+        /// <param name="finished">New timestamp value or null.</param>
+        public void UpdateItemFinished(string transactionId, string itemId, DateTime? finished);
+
+        #endregion
+        #region **** Item Attributes ****
+
+        /// <summary>
+        /// Creates a new item attribute with the specified <paramref name="name"/> and <paramref name="value"/> for the item specified by the <paramref name="itemId"/>.
+        /// <remarks>
+        /// If <paramref name="transactionId"/> not exists, the method should throw an exception.
+        /// If <paramref name="itemId"/> not exists, the method should throw an exception.
+        /// If <paramref name="name"/> already exists, the method should throw an exception.
+        /// </remarks>
+        /// </summary>
+        /// <param name="transactionId">Transaction identifier generated by <see cref="CreateTransaction"/> operation.</param>
+        /// <param name="itemId">Item identifier.</param>
+        /// <param name="name">Unique attribute name in <paramref name="itemId"/> scope.</param>
+        /// <param name="value">Value serialized as string or null.</param>
+        /// <param name="valueTypeClass">Value type qualified class name.</param>
+        /// <param name="isOutput">Flag defines if attribute is input/output.</param>
+        public void CreateItemAttribute(string transactionId, string itemId, string name, string? value, string valueTypeClass,bool isOutput);
+        
+        /// <summary>
+        /// Updates the value of the item attribute specified by the <paramref name="name"/> for the item specified by the <paramref name="itemId"/>.
+        /// <remarks>
+        /// If <paramref name="transactionId"/> not exists, the method should throw an exception.
+        /// If <paramref name="itemId"/> not exists, the method should throw an exception.
+        /// If <paramref name="name"/> not exists, the method should throw an exception.
+        /// </remarks>
+        /// </summary>
+        /// <param name="transactionId">Transaction identifier generated by <see cref="CreateTransaction"/> operation.</param>
+        /// <param name="itemId">Item identifier.</param>
+        /// <param name="name">Unique attribute name in <paramref name="itemId"/> scope.</param>
+        /// <param name="value">Value serialized as string or null.</param>
+        public void UpdateItemAttribute(string transactionId, string itemId, string name, string value);
+
+        /// <summary>
+        /// Deletes the item attribute specified by the <paramref name="name"/> for the item specified by the <paramref name="itemId"/>.
+        /// <remarks>
+        /// If <paramref name="transactionId"/> not exists, the method should throw an exception.
+        /// If <paramref name="itemId"/> not exists, the method should throw an exception.
+        /// If <paramref name="name"/> not exists, the method should throw an exception.
+        /// </remarks>
+        /// </summary>
+        /// <param name="transactionId">Transaction identifier generated by <see cref="CreateTransaction"/> operation.</param>
+        /// <param name="itemId">Item identifier.</param>
+        /// <param name="name">Unique attribute name in <paramref name="itemId"/> scope.</param>
+        public void DeleteItemAttribute(string transactionId, string itemId, string name);
+
+        #endregion
+        #region **** Item Collections ****
+        /// <summary>
+        /// Appends a new log record to the item specified by the <paramref name="itemId"/>.
+        /// <remarks>
+        /// If <paramref name="transactionId"/> not exists, the method should throw an exception.
+        /// If <paramref name="itemId"/> not exists, the method should throw an exception.
+        /// </remarks>
+        /// </summary>
+        /// <param name="transactionId">Transaction identifier generated by <see cref="CreateTransaction"/> operation.</param>
+        /// <param name="itemId">Item identifier.</param>
+        /// <param name="message">Log message.</param>
+        /// <param name="code">Message code</param>
+        /// <param name="messageType">Message type</param>
+        public void AppendLog(string transactionId, string itemId, string message, int code, ErrorLevelEnum messageType);
+        /// <summary>
+        /// Appends a new status journal record to the item specified by the <paramref name="itemId"/>.
+        /// <remarks>
+        /// If <paramref name="transactionId"/> not exists, the method should throw an exception.
+        /// If <paramref name="itemId"/> not exists, the method should throw an exception.
+        /// </remarks>
+        /// </summary>
+        /// <param name="transactionId">Transaction identifier generated by <see cref="CreateTransaction"/> operation.</param>
+        /// <param name="itemId">Item identifier.</param>
+        /// <param name="status">Previous status.</param>
+        /// <param name="isTransient">Previous isTransient flag.</param>
+        /// <param name="message">Message.</param>
+        public void AppendStatusJournal(string transactionId, string itemId, PsStatusEnum status, bool isTransient, string message);
+        #endregion
+
+        #region **** Queries & Get ****
+        /// <summary>
+        /// Returns collection of process item by input conditions.
+        /// <remarks>
+        /// Query items outside the transaction scope (must be committed).
+        /// </remarks>
+        /// </summary>
+        /// <param name="owner">Owner identifier. If null then condition is skipped.</param>
+        /// <param name="ownerRef">Owner reference identifier. If null then condition is skipped.</param>
+        /// <param name="status">Collection of requested complex statuses (isTransient, Status).</param>
+        /// <returns>Queryable collection of requested items.</returns>
+        public IQueryable<IPsQueueItem> Query(string? owner, string? ownerRef, params Tuple<bool,PsStatusEnum>[] status);
+        
+        /// <summary>
+        /// Gets the item specified by the <paramref name="itemId"/>.
+        /// <remarks>
+        /// If <paramref name="transactionId"/> not exists, the method should throw an exception.
+        /// If <paramref name="itemId"/> not exists, the method should throw an exception.
+        /// </remarks>
+        /// </summary>
+        /// <param name="transactionId">Transaction identifier generated by <see cref="CreateTransaction"/> operation. If null works outside transaction scope.</param>
+        /// <param name="itemId">Item identifier.</param>
+        /// <returns>Requested item.</returns>
+        public IPsQueueItem GetItem(string? transactionId, string itemId);
+        #endregion
+        #endregion
+    }
+
+}

+ 14 - 0
qdr.fnd.core.pqueue/qdr.fnd.core.pqueue.csproj

@@ -0,0 +1,14 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>net7.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="qdr.fnd.core" Version="0.0.3-alpha" />
+  </ItemGroup>
+
+</Project>

+ 25 - 0
qdr.fnd.core.pqueue/qdr.fnd.core.pqueue.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.8.34525.116
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "qdr.fnd.core.pqueue", "qdr.fnd.core.pqueue.csproj", "{317F61E7-0FEB-4863-BA0E-4217A558D224}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{317F61E7-0FEB-4863-BA0E-4217A558D224}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{317F61E7-0FEB-4863-BA0E-4217A558D224}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{317F61E7-0FEB-4863-BA0E-4217A558D224}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{317F61E7-0FEB-4863-BA0E-4217A558D224}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {8CF77B44-3034-43BC-9964-E1A956F0CEF7}
+	EndGlobalSection
+EndGlobal