/// <summary> /// Default implementation - overridable in subclasses.</summary> /// <param name="consumerTags">The set of consumer tags that where cancelled</param> /// <remarks> /// This default implementation simply sets the <see cref="IsRunning"/> /// property to false, and takes no further action. /// </remarks> public virtual void OnCancel(params string[] consumerTags) { IsRunning = false; foreach (EventHandler <ConsumerEventArgs> h in ConsumerCancelled?.GetInvocationList() ?? Array.Empty <Delegate>()) { h(this, new ConsumerEventArgs(consumerTags)); } foreach (string consumerTag in consumerTags) { _consumerTags.Remove(consumerTag); } }
/// <summary> /// Default implementation - overridable in subclasses.</summary> /// <param name="consumerTags">The set of consumer tags that where cancelled</param> /// <remarks> /// This default implementation simply sets the <see cref="IsRunning"/> /// property to false, and takes no further action. /// </remarks> public virtual async Task OnCancel(params string[] consumerTags) { IsRunning = false; foreach (AsyncEventHandler <ConsumerEventArgs> h in ConsumerCancelled?.GetInvocationList() ?? Array.Empty <Delegate>()) { await h(this, new ConsumerEventArgs(consumerTags)).ConfigureAwait(false); } foreach (string consumerTag in consumerTags) { _consumerTags.Remove(consumerTag); } }