-
-
Save michaelklishin/fb4ae5a53a537cc73e4f to your computer and use it in GitHub Desktop.
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 ruby | |
Bundler.setup | |
require "bunny" | |
conn = Bunny.new | |
conn.start | |
ch = conn.create_channel | |
q = ch.queue("", exclusive: true) | |
q.bind(ch.topic("amq.topic"), routing_key: "builds").subscribe(block: true) do |_, _, payload| | |
puts "Payload: #{payload}" | |
end |
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 ruby | |
Bundler.setup | |
require "mqtt" | |
c = MQTT::Client.connect( | |
remote_host: "127.0.0.1", | |
remote_port: 1883, | |
username: "guest", | |
password: "guest") | |
loop do | |
m = "Message @ #{Time.now.to_i}" | |
c.publish("builds", m) | |
puts "=> Published #{m}" | |
sleep 0.2 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment