pyinfra/mini_queue/producer.py
2022-02-14 15:43:26 +01:00

11 lines
310 B
Python

import pika
def produce_response(parameters, queue, body):
connection = pika.BlockingConnection(parameters)
channel = connection.channel()
channel.queue_declare(queue=queue, durable=True)
channel.basic_publish("", queue, body)
print(f" [x] Sent {body} on {queue}")
connection.close()