Class: PikaQ::Connection
- Inherits:
-
Object
- Object
- PikaQ::Connection
- Defined in:
- lib/pika_q/connection.rb
Instance Attribute Summary collapse
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
-
#rabbitmq_url ⇒ Object
readonly
Returns the value of attribute rabbitmq_url.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
Instance Method Summary collapse
-
#initialize(rabbitmq_url = ENV['RABBITMQ_URL'], options = { read_timeout: 10, heartbeat: 10 }) ⇒ Connection
constructor
A new instance of Connection.
Constructor Details
#initialize(rabbitmq_url = ENV['RABBITMQ_URL'], options = { read_timeout: 10, heartbeat: 10 }) ⇒ Connection
Returns a new instance of Connection.
7 8 9 10 11 |
# File 'lib/pika_q/connection.rb', line 7 def initialize(rabbitmq_url = ENV['RABBITMQ_URL'], = { read_timeout: 10, heartbeat: 10 }) @session = Bunny.new(rabbitmq_url, ) @session.start @channel = @session.create_channel end |
Instance Attribute Details
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
5 6 7 |
# File 'lib/pika_q/connection.rb', line 5 def channel @channel end |
#rabbitmq_url ⇒ Object (readonly)
Returns the value of attribute rabbitmq_url.
5 6 7 |
# File 'lib/pika_q/connection.rb', line 5 def rabbitmq_url @rabbitmq_url end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
5 6 7 |
# File 'lib/pika_q/connection.rb', line 5 def session @session end |