public EventStoreBusPublisher(IMessageSender sender, IPendingEventsQueue queue, IEventStoreBusPublisherInstrumentation instrumentation) { this.sender = sender; this.queue = queue; this.instrumentation = instrumentation; this.enqueuedKeys = new BlockingCollection <string>(); this.dynamicThrottling = new DynamicThrottling( maxDegreeOfParallelism: 230, minDegreeOfParallelism: 30, penaltyAmount: 3, workFailedPenaltyAmount: 10, workCompletedParallelismGain: 1, intervalForRestoringDegreeOfParallelism: 8000); this.queue.Retrying += (s, e) => this.dynamicThrottling.Penalize(); this.sender.Retrying += (s, e) => this.dynamicThrottling.Penalize(); }
public EventStoreBusPublisher(IMessageSender sender, IPendingEventsQueue queue, IEventStoreBusPublisherInstrumentation instrumentation) { this.sender = sender; this.queue = queue; this.instrumentation = instrumentation; enqueuedKeys = new BlockingCollection <string>(); dynamicThrottling = new DynamicThrottling( 230, 30, 3, 10, 1, 8000); this.queue.Retrying += (s, e) => dynamicThrottling.Penalize(); this.sender.Retrying += (s, e) => dynamicThrottling.Penalize(); }