[rabbitmq-discuss] publish to empty exchange works, while publish to correct exchange doesn't
Marek Majkowski
majek04 at gmail.com
Wed Jan 26 19:00:39 GMT 2011
On Tue, Jan 25, 2011 at 20:44, Marcin Krol <mrkafk at gmail.com> wrote:
> Yes, it's RPC time again. ;-)
>
> In client:
>
> chan.exchange_declare(exchange = rpc_res_exch,type='direct')
> chan.queue_declare(queue = myqueue)
> chan.queue_bind(exchange = rpc_res_exch, queue = myqueue)
>
>
> Now, when I do in server:
>
> ch.basic_publish(
> exchange = '',
> properties = pika.BasicProperties(correlation_id =
> props.correlation_id + '_' + mynode),
> routing_key = props.reply_to,
> body = str(response))
>
> ... messages get delivered to 'myqueue'.
>
> But when I do:
>
> ch.basic_publish(
> exchange = rpc_res_exch,
> properties = pika.BasicProperties(correlation_id =
> props.correlation_id + '_' + mynode),
> routing_key = props.reply_to,
> body = str(response))
>
> ... messages do NOT get delivered to the queue.
>
> I checked with rabbitmqctl list_queues (it should show number of
> messages in queue next to queue name, right?)
>
>
> Can anyone please explain this mystery to me?
chan.exchange_declare(exchange = rpc_res_exch,type='direct')
chan.queue_declare(queue = myqueue)
chan.queue_bind(exchange = rpc_res_exch, queue = myqueue)
When you bind to an exchange that is "direct" you must supply
a sane routing key (aka: binding key). More here:
http://www.rabbitmq.com/tutorial-four-python.html
Cheers,
Marek
More information about the rabbitmq-discuss
mailing list