require "baton" require "amqp" require "json" require "eventmachine" require "baton/channel" module Baton class <%= config[:constant_array].last %>Monitor include Baton::Logging def self.run monitor = <%= config[:constant_array].last %>Monitor.new monitor.run end def run logger.info "Starting <%= config[:name] %> monitor v#{Baton::VERSION}" EM.run do baton_channel = Baton::Channel.new queue = baton_channel.channel.queue("<%= config[:name] %>-monitor") exchange_out = baton_channel.channel.direct(Baton.configuration.exchange_out) queue.bind(exchange_out).subscribe do |payload| logger.info "Message read: #{payload}" #TODO Do something with the payload here end end end end end