Posting messages in two RabbitMQ queue, instead of one (using py-amqp)
Posted
by Khelben
on Stack Overflow
See other posts from Stack Overflow
or by Khelben
Published on 2010-04-27T08:10:46Z
Indexed on
2010/04/27
8:13 UTC
Read the original article
Hit count: 486
I've got this strange problem using py-amqp and the Flopsy module. I have written a publisher that sends messages to a RabbitMQ server, and I wanted to be able to send it to a specified queue. On the Flopsy module that is not possible, so I tweaked it adding a parameter and a line to declare the queue on the init_ method of the Publisher object
def __init__(self, routing_key=DEFAULT_ROUTING_KEY,
exchange=DEFAULT_EXCHANGE, connection=None,
delivery_mode=DEFAULT_DELIVERY_MODE, queue=DEFAULT_QUEUE):
self.connection = connection or Connection()
self.channel = self.connection.connection.channel()
self.channel.queue_declare(queue) # ADDED TO SET UP QUEUE
self.exchange = exchange
self.routing_key = routing_key
self.delivery_mode = delivery_mode
The channel object is part of the py-amqplib library
The problem I've got it's that, even if it's sending the messages to the specified queue, it's ALSO sending the messages to the default queue. AS in this system we expect to send quite a lot of messages, we don't want to stress the system making useless duplicates... I've tried to debug the code and go inside the py-amqplib library, but I'm not able figure out any error or lacking step. Also, I'm not able to find any documentation form py-amqplib outside the code.
Any ideas on why is this happening and how to correct it?
© Stack Overflow or respective owner