Class: Hopper::Queue

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

Constant Summary collapse

PRELOAD_FACTOR =
3

Instance Method Summary collapse

Constructor Details

#initialize(queue_name, opts = {}) ⇒ Queue

Returns a new instance of Queue.



9
10
11
12
13
# File 'lib/hopper/queue.rb', line 9

def initialize(queue_name, opts = {})
  @name = queue_name

  @shaper = opts[:shaper]
end

Instance Method Details

#for_channel(channel) ⇒ Object



15
16
17
# File 'lib/hopper/queue.rb', line 15

def for_channel(channel)
  channel.queue(@name)
end

#listener(channel, opts = {}) ⇒ Object



19
20
21
22
# File 'lib/hopper/queue.rb', line 19

def listener(channel, opts = {})
  queue = for_channel(channel)
  queue.listener
end

#publisher(channel, opts = {}) ⇒ Object



24
25
26
27
# File 'lib/hopper/queue.rb', line 24

def publisher(channel, opts = {})
  queue = for_channel(channel)
  queue.publisher
end