python - Why is RabbitMQ not persisting messages on a durable queue? -


i using rabbitmq django through celery. using basic setup:

# rabbitmq connection settings broker_host = 'localhost' broker_port = '5672' broker_user = 'guest' broker_password = 'guest' broker_vhost = '/' 

i imported celery task , queued run 1 year later. ipython shell:

in [1]: apps.test_app.tasks import add  in [2]: dt=datetime.datetime(2012, 2, 18, 10, 00)  in [3]: add.apply_async((10, 6), eta=dt) debug:amqplib:start server, version: 8.0, properties: {u'information': 'licensed under mpl.  see http://www.rabbitmq.com/', u'product': 'rabbitmq', u'version': '2.2.0', u'copyright': 'copyright (c) 2007-2010 lshift ltd., cohesive financial technologies llc., , rabbit technologies ltd.', u'platform': 'erlang/otp'}, mechanisms: ['plain', 'amqplain'], locales: ['en_us'] debug:amqplib:open ok! known_hosts [] debug:amqplib:using channel_id: 1 debug:amqplib:channel open debug:amqplib:closed channel #1 out[3]: <asyncresult: cfc507a1-175f-438e-acea-8c989a120ab3> 

rabbitmq received message in celery queue:

$  rabbitmqctl list_queues name messages durable listing queues ... ktmacbook.local.celeryd.pidbox  0   false celery  1   true celeryctl_ktmacbook.local   0   true ...done. 

i killed rabbitmq hitting control-c followed 'a' abort. when start server again , check rabbitmqctl, says there no messages in celery queue:

$  rabbitmqctl list_queues name messages durable listing queues ... celery  0   true celeryctl_ktmacbook.local   0   true ...done. 

the celery queue durable. why messages not persisted? need make messages persistent?

to find out messages delivery_mode can consume , @ message properties:

>>> tasks import add >>> add.delay(2, 2)  >>> celery import current_app >>> conn = current_app.broker_connection() >>> consumer = current_app.amqp.get_task_consumer(conn)  >>> messages = [] >>> def callback(body, message): ...     messages.append(message) >>> consumer.register_callback(callback) >>> consumer.consume()  >>> conn.drain_events(timeout=1)  >>> messages[0].properties >>> messages[0].properties {'application_headers': {}, 'delivery_mode': 2, 'content_encoding': u'binary',    'content_type': u'application/x-python-serialize'} 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -