Hello everyone,

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?




Server code:

http://pastie.org/pastes/1497146/text

Client code:

http://pastie.org/pastes/1497144/text





- --

Regards,
mk

- --
Premature optimization is the root of all fun.

Search Discussions

  • Marek Majkowski at Jan 26, 2011 at 7:00 pm

    On Tue, Jan 25, 2011 at 20:44, Marcin Krol 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
  • Marcin Krol at Jan 27, 2011 at 7:46 pm

    Marek Majkowski wrote:

    When you bind to an exchange that is "direct" you must supply
    a sane routing key (aka: binding key). More here:
    Thanks! that was it. Hmm I should probably RTFM.


    - --

    Regards,
    mk

    - --
    Premature optimization is the root of all fun.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprabbitmq-discuss @
categoriesrabbitmq
postedJan 25, '11 at 8:44p
activeJan 27, '11 at 7:46p
posts3
users2
websiterabbitmq.com
irc#rabbitmq

2 users in discussion

Marcin Krol: 2 posts Marek Majkowski: 1 post

People

Translate

site design / logo © 2021 Grokbase