Class: ChiliLogger::MainBroker
- Inherits:
-
Object
- Object
- ChiliLogger::MainBroker
- Defined in:
- lib/brokers/main_broker.rb
Overview
class that configures and manages all supported brokers
Instance Method Summary collapse
-
#initialize(broker_name, broker_config, logging_error_handler) ⇒ MainBroker
constructor
A new instance of MainBroker.
- #publish(message) ⇒ Object
Constructor Details
#initialize(broker_name, broker_config, logging_error_handler) ⇒ MainBroker
Returns a new instance of MainBroker.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/brokers/main_broker.rb', line 8 def initialize(broker_name, broker_config, logging_error_handler) return if ChiliLogger.instance.deactivated @default = ChiliLogger::Values::Default.new @logging_error_handler = logging_error_handler broker_config ||= {} validate_config(broker_config) broker_name ||= @default.msg_broker broker_class = supported_brokers[broker_name.to_sym] unsupported_broker_error(broker_name) unless broker_class @broker = broker_class.new(broker_config) end |
Instance Method Details
#publish(message) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/brokers/main_broker.rb', line 23 def publish() return if ChiliLogger.instance.deactivated @broker.publish() rescue StandardError => e @logging_error_handler.handle_error(e, ) end |