Module: Droid::BackwardsCompatibleMethods

Included in:
Droid
Defined in:
lib/droid/queue.rb

Instance Method Summary collapse

Instance Method Details

#listen4(key, orig_opts = {}, &block) ⇒ Object



178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/droid/queue.rb', line 178

def listen4(key, orig_opts={}, &block)
  opts = {}
  amqp_opts = {}
  subscribe_opts = {}

  if orig_opts[:prefetch] || orig_opts[:ack]
    opts[:prefetch] = orig_opts[:prefetch] || 1
    opts[:ack] = true
  end
  if orig_opts[:queue]
    opts[:queue] = orig_opts[:queue]
  end
  if orig_opts[:detail]
    subscribe_opts[:detail] = true
  end

  BackwardsCompatibleQueue.new(key, opts).subscribe(amqp_opts, subscribe_opts, &block)
end