Fetch the repository succeeded.
#!/usr/bin/env ruby
require 'bunny'
abort "Usage: #{$PROGRAM_NAME} [binding key]" if ARGV.empty?
connection = Bunny.new(automatically_recover: false)
connection.start
channel = connection.create_channel
exchange = channel.topic('topic_logs')
queue = channel.queue('', exclusive: true)
ARGV.each do |severity|
queue.bind(exchange, routing_key: severity)
end
puts ' [*] Waiting for logs. To exit press CTRL+C'
begin
# block: true is only used to keep the main thread
# alive. Please avoid using it in real world applications.
queue.subscribe(block: true) do |delivery_info, _properties, body|
puts " [x] #{delivery_info.routing_key}:#{body}"
end
rescue Interrupt => _
channel.close
connection.close
exit(0)
end
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。