Class: Superbolt::Adapter::Bunny

Inherits:
Base
  • Object
show all
Defined in:
lib/superbolt/adapter/bunny.rb

Instance Attribute Summary

Attributes inherited from Base

#config

Instance Method Summary collapse

Methods inherited from Base

#exchange, #initialize

Constructor Details

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

Instance Method Details

#channelObject



14
15
16
# File 'lib/superbolt/adapter/bunny.rb', line 14

def channel
  @channel ||= socket.create_channel
end

#closeObject



18
19
20
21
22
# File 'lib/superbolt/adapter/bunny.rb', line 18

def close
  response = channel.close
  @channel = nil
  response
end

#establish_socketObject



8
9
10
11
12
# File 'lib/superbolt/adapter/bunny.rb', line 8

def establish_socket
  socket = ::Bunny.new(config.connection_params)
  socket.start
  socket
end

#socketObject



4
5
6
# File 'lib/superbolt/adapter/bunny.rb', line 4

def socket
  Thread.current[:bunny_socket] ||= establish_socket
end