Class: MultipleMan::Connection
- Inherits:
-
Object
- Object
- MultipleMan::Connection
- Defined in:
- lib/multiple_man/connection.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(channel) ⇒ Connection
constructor
A new instance of Connection.
- #topic ⇒ Object
- #topic_name ⇒ Object
Constructor Details
#initialize(channel) ⇒ Connection
Returns a new instance of Connection.
26 27 28 |
# File 'lib/multiple_man/connection.rb', line 26 def initialize(channel) self.channel = channel end |
Class Method Details
.channel_pool ⇒ Object
16 17 18 |
# File 'lib/multiple_man/connection.rb', line 16 def self.channel_pool @channel_pool ||= ConnectionPool.new(size: 25, timeout: 5) { connection.create_channel } end |
.connect ⇒ Object
20 21 22 23 24 |
# File 'lib/multiple_man/connection.rb', line 20 def self.connect channel_pool.with do |channel| yield new(channel) if block_given? end end |
.connection ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/multiple_man/connection.rb', line 7 def self.connection @connection ||= begin connection = Bunny.new(MultipleMan.configuration.connection) MultipleMan.logger.debug "Connecting to #{MultipleMan.configuration.connection}" connection.start connection end end |
Instance Method Details
#topic ⇒ Object
30 31 32 |
# File 'lib/multiple_man/connection.rb', line 30 def topic @topic ||= channel.topic(topic_name) end |
#topic_name ⇒ Object
34 35 36 |
# File 'lib/multiple_man/connection.rb', line 34 def topic_name MultipleMan.configuration.topic_name end |