2022-04-14 11:02:52 +00:00
|
|
|
from __future__ import annotations
|
|
|
|
|
2012-12-11 04:35:02 +00:00
|
|
|
import datetime
|
|
|
|
|
2016-04-06 20:14:05 +00:00
|
|
|
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')
|
2020-07-13 13:58:06 +00:00
|
|
|
message = f'helloworld, sent at {datetime.datetime.today()}'
|
2012-12-11 04:35:02 +00:00
|
|
|
simple_queue.put(message)
|
2020-07-13 13:58:06 +00:00
|
|
|
print(f'Sent: {message}')
|
2012-12-11 04:35:02 +00:00
|
|
|
simple_queue.close()
|