official-images/test/tests/rabbitmq-basics/send.py

16 lines
388 B
Python
Executable File

#!/usr/bin/env python3
import pika, sys
# https://www.rabbitmq.com/tutorials/tutorial-one-python.html
connection = pika.BlockingConnection(pika.ConnectionParameters('rabbitmq'))
channel = connection.channel()
channel.queue_declare(queue='hello')
channel.basic_publish(exchange='',
routing_key='hello',
body=sys.argv[1])
connection.close()