I need to fork a stream which is tagged with its name and the content.
There are multiple subscribers and have only one publisher. So basically, I need a SPMC (single async stream and then multiplex to multiple substreams). In other word, multicasting.
Each worker read from the stream in parallel and ignore the message that doesn't equal its tagged name, so it only processes the item that shares tagged name. Multiple workers can have the same tagged name as well.
I cannot use bounded broadcast channel because the upstream channel is unbounded. This means I cannot predict the backpressure but I cannot drop the messages to the substreams either.
I tried using Flume, Loole, Kanal, but calling them MPMC is a misnomer. They only guarantee that exactly one receiver to receive the message so it does not push to all substreams. In other word, they are not broadcast channel.
I tried barrage - Rust (docs.rs), broadcaster, circulate - Rust (github.com) and they are almost spot on except the former two have memory leak problem and the last one requires Serde.
I'm looking for a more lightweight solution like those that won't create a huge memory leak over time and something that's efficient and tiny.