Example from "Quick Overview" page hangs when using 'memory' transport

29 views
Skip to first unread message

Kenn Knowles

unread,
Nov 1, 2011, 9:30:47 PM11/1/11
to carrot-users
Hi all,

I'm in the process of switching from directly using amqplib to kombu.
I am doing this so that I can use the in-memory implementation to unit-
test. However, I have discovered that even the first example from the
Quick Overview (http://kombu.readthedocs.org/en/latest/
introduction.html#quick-overview) does not work as expected for the in-
memory transport. If one instantiates the connection as
BrokerConnection(transport='memory'), no message is printed. I have
confirmed that the very same code does work with an actual rabbitmq
server.

From what I can tell from reading the unit tests for the in-memory
transport, the queue to be used must actually be bound and declared
prior to creating the Producer instance. I do not know the guts of
kombu enough to explain this.

Any tips? Thanks in advance!

- Kenn

Ask Solem

unread,
Nov 3, 2011, 4:50:12 PM11/3/11
to carrot-users
You are right, the queue must be declared so that the message
can be routed to the queue. And this is true for many of the virtual
transports.


I've updated the example, as it is a best practice in Kombu to have
both
publishers and consumers declare the queues they need.

Kenn Knowles

unread,
Nov 6, 2011, 1:09:44 AM11/6/11
to carrot...@googlegroups.com
Thanks for the response,

My use case is a pub/sub system where queues are added dynamically to a single topic exchange, so they generally cannot be declared before the exchange/producer. Do you have some other advice for this use case? (I do know that it works with a rabbitmq amqp transport, I just have to run a local server to run my unit tests at the moment)

- Kenn

Reply all
Reply to author
Forward
0 new messages