I've been using ConcurrentQueue
and BroadcastBlock
to discard all but the most recent messages when my queue gets backed up.
I have a new situation where messages are received with group ids.
Now instead of discarding all messages when a new messages arrives, I only want to discard previous messages that are still in the queue that have the matching group id.
Does this pattern already exist as a block or queue type?
ISourceBlock<TOutput>.LinkTo
takes a delegate that can process a new message, is this the point at which I should prune other messages from the queue?