Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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
#!/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
You can’t perform that action at this time.