DAGDA SEARCH | Back to results | Support

bunny_publish.rb · GitHub

Source: https://gist.github.com/rattrap/a8d5f9c2bfc8a448b9932029a38ec37f

Instantly share code, notes, and snippets.

@rattrap

rattrap/bunny_publish.rb

Created February 20, 2018 16:28 Show Gist options

Select an option

No results found

Learn more about clone URLs Clone this repository at <script src="https://gist.github.com/rattrap/a8d5f9c2bfc8a448b9932029a38ec37f.js"></script> Save rattrap/a8d5f9c2bfc8a448b9932029a38ec37f to your computer and use it in GitHub Desktop. Download ZIP Raw bunny_publish.rb This file contains hidden or 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 Show hidden characters
require "bunny"
# Start a communication session with RabbitMQ
conn = Bunny.new("amqp://username:password@rabbit-server:5672/%2F")
conn.start
# open a channel
ch = conn.create_channel
# declare a queue
q = ch.queue("test", durable:true)
while true do
q.publish("test")
end
# close the connection
conn.stop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment