Class: Chef::Deployment::Monitor::RmqSink

Inherits:
Sink
  • Object
show all
Defined in:
lib/chef_deployment_monitor/sinks.rb

Instance Method Summary collapse

Constructor Details

#initializeRmqSink

Returns a new instance of RmqSink.



12
13
14
15
16
17
18
# File 'lib/chef_deployment_monitor/sinks.rb', line 12

def initialize
  @conn = Bunny.new(hostname: Monitor::Config[:mq_server])
  @conn.start

  @ch = @conn.create_channel
  @q  = @ch.queue(Monitor::Config[:mq_queue], durable: true)
end

Instance Method Details

#receive(data) ⇒ Object



20
21
22
# File 'lib/chef_deployment_monitor/sinks.rb', line 20

def receive(data)
  @q.publish(data, persistent: true, content_type: 'application/json')
end