public WebhookDequeuer(WebhookSender webhookSender, IWebhookEventRepository webhookEventRepository, ISchemaWebhookRepository webhookRepository, IClock clock, ISemanticLog log) { Guard.NotNull(webhookEventRepository, nameof(webhookEventRepository)); Guard.NotNull(webhookRepository, nameof(webhookRepository)); Guard.NotNull(webhookSender, nameof(webhookSender)); Guard.NotNull(clock, nameof(clock)); Guard.NotNull(log, nameof(log)); this.webhookEventRepository = webhookEventRepository; this.webhookRepository = webhookRepository; this.webhookSender = webhookSender; this.clock = clock; this.log = log; requestBlock = new ActionBlock <IWebhookEventEntity>(MakeRequestAsync, new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = 32, BoundedCapacity = 32 }); blockBlock = new TransformBlock <IWebhookEventEntity, IWebhookEventEntity>(x => BlockAsync(x), new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = 1, BoundedCapacity = 1 }); blockBlock.LinkTo(requestBlock, new DataflowLinkOptions { PropagateCompletion = true }); timer = new CompletionTimer(5000, QueryAsync); }