How to register new consumer after starting rabbitmq ioloop?

Viewed 53

I am experimenting with pika API for rabbitmq and am observing a weird bahaviour. I have three threads.

Thread 1: Creates new queues and produces messages using a thread specific connection conn1. All messages get routed to all queues.

Thread 2: Instantiates SelectConnection - conn2 and a channel chan1

Thread 3: In a loop calls chan1.basic_consume() for each queue created by thread 1. Each queue has a unique message handler. (one message consumer per queue)

When I see the output I find that last message handler is handling messages from all the queues.

How do I ensure that the handlers for different consumers don't get overwritten ? Is this because I am calling basic_consume() from a separate thread or because I am calling it after calling ioloop.start() ?

I can paste the code here if required.

0 Answers
Related