public void AddConsumer(String consumerId, Func <IChunk, Task> consumerAction) { ExecutionDataflowBlockOptions consumerOptions = new ExecutionDataflowBlockOptions(); consumerOptions.BoundedCapacity = _bufferSize; ConsumerActionWrapper wrapper = new ConsumerActionWrapper(consumerId, consumerAction, this); var actionBlock = new ActionBlock <IChunk>((Func <IChunk, Task>)wrapper.Consume, consumerOptions); _consumers.Add(actionBlock); }
public void AddConsumer(Action <ICommit> consumerAction) { ExecutionDataflowBlockOptions consumerOptions = new ExecutionDataflowBlockOptions(); consumerOptions.BoundedCapacity = _bufferSize; ConsumerActionWrapper wrapper = new ConsumerActionWrapper(consumerAction, this); var actionBlock = new ActionBlock <ICommit>((Action <ICommit>)wrapper.Consume, consumerOptions); _consumers.Add(actionBlock); }