Class: SneakersRequeueOnError::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/sneakers_requeue_on_error/handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(channel, _queue, opts) ⇒ Handler

Returns a new instance of Handler.



3
4
5
6
# File 'lib/sneakers_requeue_on_error/handler.rb', line 3

def initialize(channel, _queue, opts)
  @channel = channel
  @opts = opts
end

Instance Method Details

#acknowledge(hdr, _props, _msg) ⇒ Object



8
9
10
# File 'lib/sneakers_requeue_on_error/handler.rb', line 8

def acknowledge(hdr, _props, _msg)
  @channel.acknowledge(hdr.delivery_tag, false)
end

#error(hdr, props, msg, _err) ⇒ Object



16
17
18
# File 'lib/sneakers_requeue_on_error/handler.rb', line 16

def error(hdr, props, msg, _err)
  reject(hdr, props, msg, true)
end

#noop(hdr, props, msg) ⇒ Object



24
25
# File 'lib/sneakers_requeue_on_error/handler.rb', line 24

def noop(hdr, props, msg)
end

#reject(hdr, _props, _msg, requeue = false) ⇒ Object



12
13
14
# File 'lib/sneakers_requeue_on_error/handler.rb', line 12

def reject(hdr, _props, _msg, requeue = false)
  @channel.reject(hdr.delivery_tag, requeue)
end

#timeout(hdr, props, msg) ⇒ Object



20
21
22
# File 'lib/sneakers_requeue_on_error/handler.rb', line 20

def timeout(hdr, props, msg)
  reject(hdr, props, msg)
end