Class: RabbitMqQueueClient
- Inherits:
-
Object
- Object
- RabbitMqQueueClient
- Defined in:
- lib/eventq_rabbitmq/rabbitmq_queue_client.rb
Instance Attribute Summary collapse
-
#channel ⇒ Object
Returns the value of attribute channel.
Instance Method Summary collapse
- #get_channel ⇒ Object
-
#initialize ⇒ RabbitMqQueueClient
constructor
A new instance of RabbitMqQueueClient.
Constructor Details
#initialize ⇒ RabbitMqQueueClient
Returns a new instance of RabbitMqQueueClient.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/eventq_rabbitmq/rabbitmq_queue_client.rb', line 5 def initialize @endpoint = 'localhost' if ENV['MQ_ENDPOINT'] != nil @endpoint = ENV['MQ_ENDPOINT'] end @port = 5672 if ENV['MQ_PORT'] != nil @port = Integer(ENV['MQ_PORT']) end @user = 'guest' if ENV['MQ_USER'] != nil @user = ENV['MQ_USER'] end @password = 'guest' if ENV['MQ_PASSWORD'] != nil @password = ENV['MQ_PASSWORD'] end @ssl = false if ENV['MQ_SSL'] != nil @ssl = ENV['MQ_SSL'] end #@conn = Bunny.new(:host => @endpoint, :port => @port, :user => @user, :pass => @password, :ssl => @ssl) #@conn.start #@channel = conn.create_channel end |
Instance Attribute Details
#channel ⇒ Object
Returns the value of attribute channel.
3 4 5 |
# File 'lib/eventq_rabbitmq/rabbitmq_queue_client.rb', line 3 def channel @channel end |
Instance Method Details
#get_channel ⇒ Object
37 38 39 40 41 |
# File 'lib/eventq_rabbitmq/rabbitmq_queue_client.rb', line 37 def get_channel conn = Bunny.new(:host => @endpoint, :port => @port, :user => @user, :pass => @password, :ssl => @ssl) conn.start return conn.create_channel end |