[rabbitmq-discuss] Unable to store messages into queue

Dinh pcdinh at gmail.com
Tue Dec 14 09:21:22 GMT 2010


Hi David,

I have changed the code

import pika

import sys

import pickle

import json


connection = pika.AsyncoreConnection(pika.ConnectionParameters(

        host='127.0.0.1',

        credentials=pika.PlainCredentials('guest', 'guest')))

channel = connection.channel()


channel.queue_declare(queue='feeds', durable=True)


message = json.dumps({"import_feed": "http://cnn.com/rss/edition.rss"})

channel.basic_publish(exchange='feeds', routing_key='feeds',

                      body=message,

                      properties=pika.BasicProperties(

                         delivery_mode = 2, # make message persistent

                      ))

print " [x] Sent %r" % (message,)

Both exchange and queue are named: feeds. Queue "feeds" does exist as I
check with "rabbitmqctl list_queues"

However it does not work

Dinh-Phams-MacBook-Pro:~ dinhpham$ sudo
/Users/dinhpham/dev/rabbitmq_server-2.2.0/sbin/rabbitmqctl list_queues name
messages_ready messages_unacknowledged
Listing queues ...
feed2 0 0
feeds 0 0
...done.

Still, no message is stored. Nothing special found in the log file.

Is there any special case I need to take into consideration?

Thanks,

Dinh

On Tue, Dec 14, 2010 at 3:55 PM, David Wragg <david at rabbitmq.com> wrote:

> Hi,
>
> Dinh <pcdinh at gmail.com> writes:
> > I got a strange situation with RabbitMQ 2.1.1, Mac OSX 10.6.5, erlang
> > version : 5.8.1.1 (not sure if it is a bug): I was unable to store
> message
> > into queue using Python clients.In fact, it is standard code I took from
> > RabbitMQ site. So it is supposed to work. It already worked before. For
> me,
> > yes.
> >
> > [...]
> > channel.queue_declare(queue='feeds', durable=True)
> > [...]
> > channel.basic_publish(exchange='', routing_key='importer',
> > [...]
>
> In the code you provide, you declare a queue called 'feeds', but you are
> trying to publish to a queue called 'importer'.  If no such queue
> exists, these published messages will simply be discarded.
>
> David
>
> --
> David Wragg
> Staff Engineer, RabbitMQ
> SpringSource, a division of VMware
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20101214/90adeae5/attachment-0001.htm>


More information about the rabbitmq-discuss mailing list