python - Posting messages in two RabbitMQ queue, instead of one (using py-amqp) -
i've got strange problem using py-amqp , flopsy module. have written publisher sends messages rabbitmq server, , wanted able send specified queue. on flopsy module not possible, tweaked adding parameter , line declare queue on _init__ method of 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 set queue self.exchange = exchange self.routing_key = routing_key self.delivery_mode = delivery_mode
the channel object part of py-amqplib library
the problem i've got it's that, if it's sending messages specified queue, it's sending messages default queue. in system expect send quite lot of messages, don't want stress system making useless duplicates... i've tried debug code , go inside py-amqplib library, i'm not able figure out error or lacking step. also, i'm not able find documentation form py-amqplib outside code.
any ideas on why happening , how correct it?
ok, i've think i've got it. unless else have better idea. i've check this tutorial on amqp assuming publisher should know queue, that's not case, need send message exchange, , consumer declare queue related exchange. allow different options on sending , receiving, can see on tutorial.
so, i've been including exchange information on both publisher , consumer, not making use of call queue_declare
, appears working fine.
Comments
Post a Comment