kombu/examples/hello_publisher.py

14 lines
390 B
Python
Raw Normal View History

from __future__ import absolute_import, unicode_literals
2012-12-11 04:35:02 +00:00
import datetime
from kombu import Connection
2012-12-11 04:35:02 +00:00
with Connection('amqp://guest:guest@localhost:5672//') as conn:
simple_queue = conn.SimpleQueue('simple_queue')
2016-05-10 03:13:56 +00:00
message = 'helloworld, sent at {0}'.format(datetime.datetime.today())
2012-12-11 04:35:02 +00:00
simple_queue.put(message)
print('Sent: {0}'.format(message))
2012-12-11 04:35:02 +00:00
simple_queue.close()