Class: Tackle::Consumer::Queue

Inherits:
Object
  • Object
show all
Defined in:
lib/tackle/consumer/queue.rb

Direct Known Subclasses

DeadQueue, DelayQueue, MainQueue

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options, connection, logger) ⇒ Queue

Returns a new instance of Queue.



7
8
9
10
11
12
13
14
# File 'lib/tackle/consumer/queue.rb', line 7

def initialize(name, options, connection, logger)
  @name = name
  @connection = connection
  @logger = logger
  @options = options

  @amqp_queue = create_amqp_queue
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/tackle/consumer/queue.rb', line 5

def name
  @name
end

Instance Method Details

#create_amqp_queueObject



16
17
18
19
20
21
22
# File 'lib/tackle/consumer/queue.rb', line 16

def create_amqp_queue
  @logger.info("Creating queue '#{@name}'")
  @connection.channel.queue(@name, @options)
rescue Exception => ex
  @logger.error "Failed to create queue '#{ex}'"
  raise ex
end