public QueueManager( IExcepticonExceptionInstancesService excepticonExceptionInstancesService, ExcepticonOptions options, CancellationTokenSource shutdownSource = null, ConcurrentQueue <ExceptionInstance> queue = null) { _excepticonExceptionInstancesService = excepticonExceptionInstancesService ?? throw new ArgumentNullException(nameof(excepticonExceptionInstancesService)); _options = options ?? throw new ArgumentNullException(nameof(options)); _shutdownSource = shutdownSource ?? new CancellationTokenSource(); _queue = queue ?? new ConcurrentQueue <ExceptionInstance>(); _queuedEventSemaphore = new SemaphoreSlim(0, _options.MaxQueueItems); WorkerTask = Task.Run(async() => await WorkerAsync(_shutdownSource.Token).ConfigureAwait(false)); }
public ExceptionHandlingMiddleware(RequestDelegate next, ExcepticonOptions options) { _next = next; _options = options ?? throw new ArgumentNullException(nameof(options)); _exceptionInstancesExcepticonExceptionInstancesService = new ExcepticonExceptionInstancesService(options); }