Does Python have filtered Queues?

Viewed 608

I've got a situation where I have one producer thread receiving messages from various different devices on the network. I also have multiple consumer threads that only want to receive the data from specific devices. What I would normally do is to have the consumer threads "register" themselves with the producer thread and create their own individual queues, which the producer thread inserts the relevant data into. However, what I'd like is to have a single queue object that the producer places messages into, and then have the consumers "get" data from the queue but with a filter, so that they only receive the messages that interest them.

Does such a filtered queue exist in Python?

0 Answers
Related