Class: Splash::Transports::Rabbitmq::Subscriber
- Inherits:
-
Object
- Object
- Splash::Transports::Rabbitmq::Subscriber
- Extended by:
- Forwardable
- Includes:
- Config
- Defined in:
- lib/splash/transports/rabbitmq.rb
Constant Summary
Constants included from Constants
Constants::AUTHOR, Constants::BACKENDS_STRUCT, Constants::CONFIG_FILE, Constants::COPYRIGHT, Constants::DAEMON_LOGMON_SCHEDULING, Constants::DAEMON_PID_FILE, Constants::DAEMON_PID_PATH, Constants::DAEMON_PROCESS_NAME, Constants::DAEMON_STDERR_TRACE, Constants::DAEMON_STDOUT_TRACE, Constants::EMAIL, Constants::EXECUTION_TEMPLATE, Constants::EXECUTION_TEMPLATE_TOKENS_LIST, Constants::LICENSE, Constants::LOGGERS_STRUCT, Constants::PROMETHEUS_PUSHGATEWAY_HOST, Constants::PROMETHEUS_PUSHGATEWAY_PORT, Constants::TRACE_PATH, Constants::TRANSPORTS_STRUCT, Constants::VERSION
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Subscriber
constructor
A new instance of Subscriber.
Methods included from Config
Methods included from ConfigUtilities
Methods included from Helpers
#daemonize, #get_process, #group_root, #install_file, #is_root?, #make_folder, #make_link, #run_as_root, #search_file_in_gem, #user_root, #verify_file, #verify_folder, #verify_link, #verify_service
Constructor Details
#initialize(options = {}) ⇒ Subscriber
Returns a new instance of Subscriber.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/splash/transports/rabbitmq.rb', line 12 def initialize( = {}) @config = get_config.transports host = @config[:rabbitmq][:host] port = @config[:rabbitmq][:port] vhost = (@config[:rabbitmq][:vhost])? @config[:rabbitmq][:vhost] : '/' passwd = (@config[:rabbitmq][:passwd])? @config[:rabbitmq][:passwd] : 'guest' user = (@config[:rabbitmq][:user])? @config[:rabbitmq][:user] : 'guest' conf = { :host => host, :vhost => vhost, :user => user, :password => passwd, :port => port.to_i} begin @connection = Bunny.new conf @connection.start @channel = @connection.create_channel @queue = @channel.queue [:queue] rescue Bunny::Exception return { :case => :service_dependence_missing, :more => "RabbitMQ Transport not available." } end end |