[rabbitmq-discuss] Exchanges, Routing, and AMQP
bp at barryp.org
Sun Nov 9 17:55:26 GMT 2008
Ben Hood wrote:
> On Sat, Nov 8, 2008 at 7:29 PM, Peter Silva <Peter.A.Silva at gmail.com> wrote:
>> That's strange... maybe I'm just getting confused by
>> a client code... Here is an example from the demo in py-amqplib...
>> ch.basic_publish(msg, EXCHANGE_NAME, routing_key=topic)
>> the 'routing_key' in this api, afaict, is one of three keywords: topic,
>> fanout, direct. what is called exchange_type in the AMQP spec.
> Are you referring to amqp_clock.py?
> If so, I think that the topic is a the name of a string variable:
> TOPIC_PATTERN = '%Y.%m.%d.%w.%H.%M' # Python datetime.strftime() pattern
> topic = now.strftime(TOPIC_PATTERN)
> ch.basic_publish(msg, EXCHANGE_NAME, routing_key=topic)
I can see where that could be a bit confusing to have a variable with
the same name as an exchange type.
I've updated the example in Mercurial to use a different variable name
so it now says:
msg_topic = now.strftime(TOPIC_PATTERN)
ch.basic_publish(msg, EXCHANGE_NAME, routing_key=msg_topic)
More information about the rabbitmq-discuss