Class: SongkickQueue::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/songkick_queue/client.rb

Instance Method Summary collapse

Instance Method Details

#channelBunny::Channel

Creates a memoized channel for issuing RabbitMQ commands

Returns:

  • (Bunny::Channel)


10
11
12
13
14
15
16
17
# File 'lib/songkick_queue/client.rb', line 10

def channel
  @channel ||= begin
    channel = connection.create_channel
    channel.prefetch(1)

    channel
  end
end

#connectionBunny::Session

Creates a memoized connection to RabbitMQ

Returns:

  • (Bunny::Session)


22
23
24
25
26
27
28
29
# File 'lib/songkick_queue/client.rb', line 22

def connection
  @connection ||= begin
    connection = Bunny.new(config_amqp)
    connection.start

    connection
  end
end

#default_exchangeObject



3
4
5
# File 'lib/songkick_queue/client.rb', line 3

def default_exchange
  channel.default_exchange
end