Skip to content

Instantly share code, notes, and snippets.

@nazarsa
Last active January 27, 2024 09:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nazarsa/29cbd2e9be1ed495ee446ed13ca6179a to your computer and use it in GitHub Desktop.
Save nazarsa/29cbd2e9be1ed495ee446ed13ca6179a to your computer and use it in GitHub Desktop.
Send Message to Rabbit MQ Python Script
#!/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