I have a relatively simple task where I need some 10 consumers to consume work to be produced into a queue, continuously.
This is my first time implementing this design pattern, so I have been searching the web for different approaches.
The ones I found were:
I have picked no. (1), for the sole reason I find it easier to understand and it feels it gives you more control. However, I have the feeling this is not anymore the modern/recommended way to do it (.NET Core days).
Could anyone give some guidance as to the practical advantages in choosing this/that approach over the other ?
This article covers performance comparison between some of these approaches, and states Channel ultimately performs better.
In a short, I have no special requirements such as maximum queue size. For the simplest scenario would the 1st approach be a good choice even today ? Or it is unreasonable to pick a thread-based implementation instead of a TPL or other more modern .NET threading stacks ?
Channel
exists is to save you from needing to write all that yourself). If you don't have any special requirements then there's no reason to roll-your own when a Channel can do all of that stuff in a single, simple line of code each for the reader (consumer) and for the writer (producer).