Class: Promiscuous::Subscriber::Worker::Recorder
- Inherits:
-
Object
- Object
- Promiscuous::Subscriber::Worker::Recorder
- Defined in:
- lib/promiscuous/subscriber/worker/recorder.rb
Instance Method Summary collapse
-
#initialize(log_file) ⇒ Recorder
constructor
A new instance of Recorder.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(log_file) ⇒ Recorder
Returns a new instance of Recorder.
2 3 4 5 |
# File 'lib/promiscuous/subscriber/worker/recorder.rb', line 2 def initialize(log_file) @log_file = log_file extend Promiscuous::AMQP::Subscriber end |
Instance Method Details
#start ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/promiscuous/subscriber/worker/recorder.rb', line 7 def start @file = File.open(@log_file, 'a') = {} [:queue_name] = "#{Promiscuous::Config.app}.promiscuous" [:bindings] = {} # We need to subscribe to everything to keep up with the version tracking Promiscuous::Config.subscriber_exchanges.each do |exchange| [:bindings][exchange] = ['*'] end subscribe() do |, payload| @file.puts payload .ack end end |
#stop ⇒ Object
23 24 25 26 |
# File 'lib/promiscuous/subscriber/worker/recorder.rb', line 23 def stop disconnect @file.try(:close) end |