class Splash::Transports::Rabbitmq::Subscriber
Subscriber
Mode RabbitMQ Client
Public Class Methods
new(options = {})
click to toggle source
Constructor Forward subscribe method and initialize a Bunny Client
atribute @queue @param [Hash] options @option options [String] :queue the name of the subscribed queue
# File lib/splash/transports/rabbitmq.rb, line 22 def initialize(options = {}) @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 options[:queue] rescue Bunny::Exception return { :case => :service_dependence_missing, :more => "RabbitMQ Transport not available." } end end