kombu/examples/hello_publisher.py

14 lines
390 B
Python

from __future__ import absolute_import, unicode_literals
import datetime
from kombu import Connection
with Connection('amqp://guest:guest@localhost:5672//') as conn:
simple_queue = conn.SimpleQueue('simple_queue')
message = 'helloworld, sent at {0}'.format(datetime.datetime.today())
simple_queue.put(message)
print('Sent: {0}'.format(message))
simple_queue.close()