Last active
January 27, 2024 09:47
-
-
Save nazarsa/29cbd2e9be1ed495ee446ed13ca6179a to your computer and use it in GitHub Desktop.
Send Message to Rabbit MQ Python Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import pika | |
connection = pika.BlockingConnection(pika.ConnectionParameters( | |
'localhost')) | |
channel = connection.channel() | |
channel.queue_declare(queue='queuename') | |
channel.basic_publish(exchange='', | |
routing_key='queuename', | |
body='Rabbit Message') | |
print(" [x] Sent 'Rabbit Message'") | |
connection.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment