-1

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?

Theodor Zoulias
  • 34,835
  • 7
  • 69
  • 104
compound eye
  • 1,898
  • 18
  • 23
  • 1
    *"I've been using `ConcurrentQueue` and `BroadcastBlock` to discard all but the most recent messages when my queue gets backed up."* -- Including in the question your existing code might be helpful for understanding what you are looking for. Alternatively you could consider describing the desirable behavior in details, comparing it with the behavior of known components, like the `BroadcastBlock`. – Theodor Zoulias Aug 23 '23 at 22:42
  • 1
    The requirement sounds like you want to explore Rx (Reactive Extensions). – Fildor Aug 24 '23 at 06:36

0 Answers0