Class: PushyDaemon::Proxy
- Inherits:
-
BmcDaemonLib::MqEndpoint
- Object
- BmcDaemonLib::MqEndpoint
- PushyDaemon::Proxy
- Defined in:
- lib/pushyd/proxy.rb
Instance Attribute Summary collapse
-
#table ⇒ Object
Class options.
Instance Method Summary collapse
-
#initialize ⇒ Proxy
constructor
A new instance of Proxy.
Constructor Details
#initialize ⇒ Proxy
Returns a new instance of Proxy.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/pushyd/proxy.rb', line 13 def initialize # Init @shouter = nil @consumers = [] # Init ASCII table @table = Terminal::Table.new @table.title = "Rules summary" @table.headings = ["rule", "topic", "route", "relay", "description", "status"] @table.align_column(5, :right) # Prepare logger @logger = BmcDaemonLib::LoggerPool.instance.get # Start connexion to RabbitMQ @conn = connect_to BmcDaemonLib::Conf[:broker] log_info "Proxy connected" # Create a new shouter @shouter = create_shouter # Check config and subscribe rules create_consumers # Send config table to logs log_info "Proxy initialized", @table.to_s puts @table.to_s # Make the shouter loop! @shouter.start_loop rescue BmcDaemonLib::MqConsumerException => e log_error "Proxy consumer: #{e.}" abort "EXITING #{e.class}: #{e.}" rescue ShouterInterrupted, EndpointConnectionError, Errno::EACCES => e log_error "Proxy error: #{e.}" abort "EXITING #{e.class}: #{e.}" rescue StandardError => e log_error "Proxy unexpected: #{e.}", e.backtrace abort "EXITING #{e.class}: #{e.} \n #{e.backtrace.to_yaml}" # raise MqConsumerException, e.message end |
Instance Attribute Details
#table ⇒ Object
Class options
11 12 13 |
# File 'lib/pushyd/proxy.rb', line 11 def table @table end |