(queue, payload)
| 27 | |
| 28 | |
| 29 | def main(queue, payload): |
| 30 | connection = pika.BlockingConnection( |
| 31 | pika.ConnectionParameters( |
| 32 | host="localhost", |
| 33 | credentials=pika.credentials.PlainCredentials( |
| 34 | username="guest", password="guest" |
| 35 | ), |
| 36 | ) |
| 37 | ) |
| 38 | channel = connection.channel() |
| 39 | |
| 40 | channel.queue_declare(queue=queue, durable=True) |
| 41 | |
| 42 | channel.basic_publish(exchange="", routing_key=queue, body=payload) |
| 43 | print("Sent %s" % payload) |
| 44 | connection.close() |
| 45 | |
| 46 | |
| 47 | if __name__ == "__main__": |
no test coverage detected