Class: Superbolt::Connection::Queue

Inherits:
Base
  • Object
show all
Defined in:
lib/superbolt/connection/queue.rb

Instance Attribute Summary

Attributes inherited from Base

#config, #name

Instance Method Summary collapse

Methods inherited from Base

#channel, default_options, #initialize, #q

Constructor Details

This class inherits a constructor from Superbolt::Connection::Base

Instance Method Details

#close(&block) ⇒ Object



8
9
10
11
12
13
# File 'lib/superbolt/connection/queue.rb', line 8

def close(&block)
  connection.close
  block.call if block
  @connection = nil
  @q = nil
end

#closing(&block) ⇒ Object



15
16
17
18
19
# File 'lib/superbolt/connection/queue.rb', line 15

def closing(&block)
  response = block.call
  close
  response
end

#connectionObject



4
5
6
# File 'lib/superbolt/connection/queue.rb', line 4

def connection
  @connection ||= Adapter::Bunny.new(config)
end

#writerObject



21
22
23
24
# File 'lib/superbolt/connection/queue.rb', line 21

def writer
  q # to make sure it is connected
  connection.exchange
end