Module: Sensu::Transport

Defined in:
lib/sensu/transport.rb,
lib/sensu/transport/base.rb,
lib/sensu/transport/rabbitmq.rb

Defined Under Namespace

Classes: Base, Error, RabbitMQ

Class Method Summary collapse

Class Method Details

.connect(transport_name, options = {}) ⇒ Object

Connect to a transport.

Parameters:

  • transport_name (String)

    transport name.

  • options (Hash) (defaults to: {})

    transport options.


15
16
17
18
19
20
21
22
23
24
# File 'lib/sensu/transport.rb', line 15

def connect(transport_name, options={})
  require("sensu/transport/#{transport_name}")
  klass = Base.descendants.detect do |klass|
    klass.name.downcase.split("::").last == transport_name
  end
  transport = klass.new
  transport.logger = @logger
  transport.connect(options)
  transport
end

.logger=(logger) ⇒ Object

Set the transport logger.

Parameters:

  • logger (Object)

    transport logger.


7
8
9
# File 'lib/sensu/transport.rb', line 7

def logger=(logger)
  @logger = logger
end