public override void Dispose() { if (_isDisposed) { _logger.LogTrace("Queue {Name} ({Id}) dispose was already called.", _options.Name, QueueId); return; } _isDisposed = true; _logger.LogTrace("Queue {Name} ({Id}) dispose", _options.Name, QueueId); _queueDisposedCancellationTokenSource?.Cancel(); _queueDisposedCancellationTokenSource?.Dispose(); base.Dispose(); Abandoned?.Dispose(); Completed?.Dispose(); Dequeued?.Dispose(); Enqueued?.Dispose(); Enqueuing?.Dispose(); LockRenewed?.Dispose(); foreach (var behavior in _behaviors.OfType <IDisposable>()) { behavior.Dispose(); } _behaviors.Clear(); }
public T Dequeue() { T item = queue.Dequeue(); Dequeued?.Invoke(null, item); return(item); }
/// <summary> /// The event which fires when the consumer receives a delivery /// </summary> /// <param name="sender">The sender.</param> /// <param name="basicDeliverEventArgs">The <see cref="BasicDeliverEventArgs"/> instance containing the event data.</param> private void ConsumerOnReceived(object sender, BasicDeliverEventArgs basicDeliverEventArgs) { byte[] body = basicDeliverEventArgs.Body; T result = JsonConvert.DeserializeObject <T>(Encoding.UTF8.GetString(body), _jss); Dequeued?.Invoke(this, result); }
/// <summary> /// Dequeues this instance. /// </summary> /// <returns></returns> public T Dequeue() { _backingQueue.TryDequeue(out T result); Dequeued?.Invoke(this, result); return(result); }
private void OnDequeued(TResult item) { try { Dequeued?.Invoke(item); } catch (Exception ex) { _context.TraceSource.ContextSwitch_Dequeued_Error(ex); } }
public virtual void Dequeue() { T item; while (!queue.IsEmpty) { if (!queue.TryDequeue(out item)) { continue; } Dequeued?.Invoke(this, new ItemEventArgs <T>(item)); break; } }
public override void Dispose() { _logger.Trace("Queue {0} dispose", _queueName); base.Dispose(); Abandoned?.Dispose(); Completed?.Dispose(); Dequeued?.Dispose(); Enqueued?.Dispose(); Enqueuing?.Dispose(); LockRenewed?.Dispose(); foreach (var behavior in _behaviors.OfType <IDisposable>()) { behavior.Dispose(); } _behaviors.Clear(); }
public override void Dispose() { _logger.LogTrace("Queue {0} dispose", _options.Name); _queueDisposedCancellationTokenSource?.Cancel(); base.Dispose(); Abandoned?.Dispose(); Completed?.Dispose(); Dequeued?.Dispose(); Enqueued?.Dispose(); Enqueuing?.Dispose(); LockRenewed?.Dispose(); foreach (var behavior in _behaviors.OfType <IDisposable>()) { behavior.Dispose(); } _behaviors.Clear(); }
protected virtual void OnDequeued() { Dequeued?.Invoke(this, new DequeueEventArgs(queue.Count)); }
public override void OnDequeue(MachineId machineId, string currentStateName, string eventName) { base.OnDequeue(machineId, currentStateName, eventName); Dequeued?.Invoke(machineId, currentStateName, eventName); }
public void OnDequeued(object sender, PersonModel person, RoomModel room) { Dequeued?.Invoke(sender, new EnqueingEventArgs(person, room)); }