I wonder whether there is a way to set the max number of items/messages a queue within a dataflow block can hold (either bufferblock or queue of actionblock) and propagate such ceiling upstream to other datablocks that may feed the datablock that contains the queue, which has its maximum items it can hold, set. I guess the queues of supplying datablocks will just increase in items, correct? Is there a way to have them lock as well or would I need to implement ceilings as well for all queues of blocks that link to the block that contains the queue with ceiling?
For example I may start with a custom producing dataflow block that links to a bufferblock. This buffer block links to an action block whose queue I like to not have exceed a certain number of items in the queue. How can I prevent the queues in the producing dataflow block or bufferblock from ever storing more and more items in their own queue knowing that the last dataflow block in the chain cannot consume more items at a point in time and that the inQueue cannot accept more items?
There isn't any “smart” way to do this, you just have to set BoundedCapacity
in each block's options when you create them.
I think there are several reasons why what you're proposing wouldn't work:
ActionBlock
has a capacity of 100 doesn't mean the BufferBlock
in front of it should have the same capacity. This is something that has to be decided by a human.That being said, I think that in your simple case, you could just get rid of the BufferBlock
and send the items from the producing block directly to the ActionBlock
.