Is there a way to batch a collection of items from the blocking collection. E.G.
I have a messaging bus publisher calling blockingCollection.Add()
And a consuming thread which is created like this:
Task.Factory.StartNew(() =>
{
foreach (string value in blockingCollection.GetConsumingEnumerable())
{
Console.WriteLine(value);
}
});
However, I only want the Console to write after the blocking collection has 10 items on it, whereas GetConsumingEnumerable() always fires after each item is added. I could write my own queue for this but I'd like to use the blocking collection if possible?