Analogue of Queue.Peek() for BlockingCollection when listening to consuming IEnumerable

后端 未结 4 1736
梦谈多话
梦谈多话 2021-01-04 13:06

I\'m using Pipelines pattern implementation to decouple messages consumer from a producer to avoid slow-consumer issue.

In case of any exception on a message processi

4条回答
  •  耶瑟儿~
    2021-01-04 13:55

    You should consider intermediate queue.

    BlockingCollection can't "peek" items because of its nature - there can be more than one consumer. One of them can peek an item, and another one can take it - hence, the first one will try to take item, that already has been taken.

提交回复
热议问题