class SongkickQueue::Client

Public Instance Methods

channel() click to toggle source

Creates a memoized channel for issuing RabbitMQ commands

@return [Bunny::Channel]

# File lib/songkick_queue/client.rb, line 10
def channel
  @channel ||= build_channel
end
connection() click to toggle source

Creates a memoized connection to RabbitMQ

@return [Bunny::Session]

# File lib/songkick_queue/client.rb, line 17
def connection
  @connection ||= build_connection
end
default_exchange() click to toggle source
# File lib/songkick_queue/client.rb, line 3
def default_exchange
  channel.default_exchange
end

Private Instance Methods

build_channel() click to toggle source
# File lib/songkick_queue/client.rb, line 23
def build_channel
  channel = connection.create_channel
  channel.prefetch(1)

  channel
end
build_connection() click to toggle source
# File lib/songkick_queue/client.rb, line 30
def build_connection
  connection = Bunny.new(
    host: config.host,
    port: config.port,
    username: config.username,
    password: config.password,
    vhost: config.vhost,
    heartbeat_interval: config.heartbeat_interval,
    automatically_recover: true,
    network_recovery_interval: config.network_recovery_interval,
    recover_from_connection_close: true,
  )

  connection.start

  connection
end
config() click to toggle source
# File lib/songkick_queue/client.rb, line 48
def config
  SongkickQueue.configuration
end