Esempio n. 1
0
        /// <summary>	Deletes the given item from the poisoned state. </summary>
        /// <remarks>	Delegates to the underlying job queue. Fires a notification on OnQueueAction if the operation was a success. </remarks>
        /// <param name="poisonedItem">	The poisoned representation of an item. </param>
        /// <returns>	true if it succeeds, false if it fails. </returns>
        /// <exception cref="ObjectDisposedException">	Thrown when the object has been disposed. </exception>
        public bool Delete(TQueuePoison poisonedItem)
        {
            ThrowIfDisposed();
            var result = _durableJobQueue.Delete(poisonedItem);

            if (result)
            {
                _onQueueAction.OnNext(DurableJobQueueAction.Deleted(poisonedItem));
            }
            return(result);
        }
Esempio n. 2
0
        /// <summary>	Removes a queued item from the pending state. </summary>
        /// <remarks>
        /// Should throw an exception if no item exists in the pending state. Delegates to the underlying job queue. Fires a notification on
        /// OnQueueAction if the operation was a success.
        /// </remarks>
        /// <param name="item">	The item. </param>
        /// <returns>	true if it succeeds, false if it fails. </returns>
        /// <exception cref="ObjectDisposedException">	Thrown when the object has been disposed. </exception>
        public bool Complete(TQueue item)
        {
            ThrowIfDisposed();
            var result = _durableJobQueue.Complete(item);

            if (result)
            {
                _onQueueAction.OnNext(DurableJobQueueAction.Completed(item));
            }
            return(result);
        }
Esempio n. 3
0
        /// <summary>	Gets the next available queued item and transitions said item to the pending state. </summary>
        /// <remarks>	Delegates to the underlying job queue. Fires a notification on OnQueueAction if the operation returned an item. </remarks>
        /// <returns>	The item if an item was queued, otherwise null. </returns>
        /// <exception cref="ObjectDisposedException">	Thrown when the object has been disposed. </exception>
        public IItem <TQueue> NextQueuedItem()
        {
            ThrowIfDisposed();
            var item = _durableJobQueue.NextQueuedItem();

            if (item.Success)
            {
                _onQueueAction.OnNext(DurableJobQueueAction.Pending(item.Value));
            }
            return(item);
        }
Esempio n. 4
0
        /// <summary>	Poisons an item, moving it from the pending state to the poisoned state. </summary>
        /// <remarks>
        /// Should throw an exception if no item exists in the pending state. Delegates to the underlying job queue. Fires a notification on
        /// OnQueueAction if the operation was a success.
        /// </remarks>
        /// <param name="item">		    The original item. </param>
        /// <param name="poisonedItem">	The original item, converted to its poisoned representation. </param>
        /// <returns>	true if it succeeds, false if it fails. </returns>
        /// <exception cref="ObjectDisposedException">	Thrown when the object has been disposed. </exception>
        public bool Poison(TQueue item, TQueuePoison poisonedItem)
        {
            ThrowIfDisposed();
            var result = _durableJobQueue.Poison(item, poisonedItem);

            if (result)
            {
                _onQueueAction.OnNext(DurableJobQueueAction.Poisoned(item, poisonedItem));
            }

            return(result);
        }
Esempio n. 5
0
 /// <summary>	Adds a new item to the queue. </summary>
 /// <remarks>	Delegates to the underlying job queue. Fires a notification on OnQueueAction. </remarks>
 /// <param name="item">	The item. </param>
 /// <exception cref="ObjectDisposedException">	Thrown when the object has been disposed. </exception>
 public void Queue(TQueue item)
 {
     ThrowIfDisposed();
     _durableJobQueue.Queue(item);
     _onQueueAction.OnNext(DurableJobQueueAction.Queued(item));
 }