main
1#!/usr/bin/env ruby
2## encoding: utf-8
3
4require "bunny"
5
6connection = Bunny.new
7connection.start
8
9channel = connection.create_channel
10exchange = channel.fanout("logs")
11queue = channel.queue("", exclusive: true)
12
13queue.bind(exchange)
14
15puts " [*] Waiting for logs. To exit press CTRL+C"
16
17begin
18 queue.subscribe(block: true) do |delivery_info, properties, body|
19 puts " [x] #{body}"
20 end
21rescue Interrupt => _
22 channel.close
23 connection.close
24end