Yes, you are right, and there is no built-in opportunity to limit the output queue. It's done in such way as there will be much more overhead to check, are the output queue full, or not.
One thing you should check is what method you are using for adding your messages. If it is Post
, it will block the thread before the message will be posted. But if you're using SendAsync
, you should await
it, in other case you will flood your RAM with await
-state machines and messages which are in a middle of posting.
However, at least two things you can do:
- Create a custom block with such property. This could be challenging and I do not recommend this.
- Introduce the
BufferBlock
in your chain for such purpose - this is default way to add some throttling in dataflow. In this case messages wouldn't proceed futher on your dataflow if there is no place. This solution will work if you link your blocks between each other.