Sha256: ad3e639a2cffdb12dc1881f62b7e439580f0c4b81da5d5c55294ce0820231742

Contents?: true

Size: 1.42 KB

Versions: 9

Compression:

Stored size: 1.42 KB

Contents

# coding: utf-8

module Splash
  module Transports
    include Splash::Config

    def get_default_subscriber(options)
      config = get_config.transports
      transport = config[:active]
      host = config[transport][:host]
      port = config[transport][:port]
      unless verify_service host: host, port: port then
        return  { :case => :service_dependence_missing, :more => "RabbitMQ Transport not available." }
       end
      aclass = "Splash::Transports::#{transport.capitalize}::Subscriber"
      begin
        return Kernel.const_get(aclass)::new(options)
      rescue
        return { :case => :configuration_error, :more => "Transport specified for queue #{options[:queue]} configuration error : #{transport}"}
      end
    end

    def get_default_client
      config = get_config.transports
      transport = config[:active]
      host = config[transport][:host]
      port = config[transport][:port]
      unless verify_service host: host, port: port then
        return  { :case => :service_dependence_missing, :more => "RabbitMQ Transport not available." }
       end
      aclass = "Splash::Transports::#{transport.to_s.capitalize}::Client"
      begin
        return Kernel.const_get(aclass)::new
      rescue
        return { :case => :configuration_error, :more => "Transport configuration error : #{transport}"}
      end
    end

  end
end

Dir[File.dirname(__FILE__) + '/transports/*.rb'].each {|file| require file  }

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
prometheus-splash-0.5.3 lib/splash/transports.rb
prometheus-splash-0.5.2 lib/splash/transports.rb
prometheus-splash-0.5.0 lib/splash/transports.rb
prometheus-splash-0.4.5 lib/splash/transports.rb
prometheus-splash-0.4.4 lib/splash/transports.rb
prometheus-splash-0.4.3 lib/splash/transports.rb
prometheus-splash-0.4.2 lib/splash/transports.rb
prometheus-splash-0.4.1 lib/splash/transports.rb
prometheus-splash-0.4.0 lib/splash/transports.rb