Instantly share code, notes, and snippets.
rattrap/bunny_publish.rb
Created February 20, 2018 16:28- Star 0 (0) You must be signed in to star a gist
- Fork 0 (0) You must be signed in to fork a gist
-
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.
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 |