def setup_transport
      transport_name = @settings[:transport][:name]
      transport_settings = @settings[transport_name]
      @logger.debug("connecting to transport", {
        :name => transport_name,
        :settings => transport_settings
      })
      Transport.logger = @logger
      Transport.connect(transport_name, transport_settings) do |connection|
        @transport = connection
        @transport.on_error do |error|
          @logger.error("transport connection error", :error => error.to_s)
          if @settings[:transport][:reconnect_on_error]
            @transport.reconnect
          else
            stop
          end
        end
        @transport.before_reconnect do
          unless testing?
            @logger.warn("reconnecting to transport")
            pause
          end
        end
        @transport.after_reconnect do
          @logger.info("reconnected to transport")
          resume
        end
        yield(@transport) if block_given?
      end
    end
def setup_transport
      transport_name = @settings[:transport][:name]
      transport_settings = @settings[transport_name]
      @logger.debug("connecting to transport", {
        :name => transport_name,
        :settings => transport_settings
      })
      Transport.logger = @logger
      Transport.connect(transport_name, transport_settings) do |connection|
        @transport = connection
        @transport.on_error do |error|
          @logger.error("transport connection error", :error => error.to_s)
          if @settings[:transport][:reconnect_on_error]
            @transport.reconnect
          else
            stop
          end
        end
        @transport.before_reconnect do
          unless testing?
            @logger.warn("reconnecting to transport")
            pause
          end
        end
        @transport.after_reconnect do
          @logger.info("reconnected to transport")
          resume
        end
        yield(@transport) if block_given?
      end
    end
Set up the Sensu transport connection. Sensu uses a transport
 API, allowing it to use various message brokers. By default,
 Sensu will use the built-in "rabbitmq" transport. The Sensu
 service will stop gracefully in the event of a transport error,
 and pause/resume in the event of connectivity issues. This
 method creates the transport instance variable: `@transport`.

 https://github.com/sensu/sensu-transport

 @yield [Object] passes initialized and connected Transport
   connection object to the callback/block.