Class: SneakersHandlers::RetryHandler
- Inherits:
-
Object
- Object
- SneakersHandlers::RetryHandler
- Defined in:
- lib/sneakers_handlers/retry_handler.rb
Instance Method Summary collapse
- #acknowledge(hdr, _props, _msg) ⇒ Object
- #error(hdr, props, msg, err) ⇒ Object
-
#initialize(channel, queue, options) ⇒ RetryHandler
constructor
A new instance of RetryHandler.
- #noop(_hdr, _props, _msg) ⇒ Object
- #reject(hdr, props, msg, requeue = false) ⇒ Object
- #timeout(hdr, props, msg) ⇒ Object
Constructor Details
#initialize(channel, queue, options) ⇒ RetryHandler
Returns a new instance of RetryHandler.
27 28 29 30 31 32 33 34 |
# File 'lib/sneakers_handlers/retry_handler.rb', line 27 def initialize(channel, queue, ) @channel = channel @queue = queue @routing_key = [:routing_key] @max_retry = [:max_retry] || 5 create_dlx(channel, queue, ) end |
Instance Method Details
#acknowledge(hdr, _props, _msg) ⇒ Object
36 37 38 |
# File 'lib/sneakers_handlers/retry_handler.rb', line 36 def acknowledge(hdr, _props, _msg) @channel.acknowledge(hdr.delivery_tag, false) end |
#error(hdr, props, msg, err) ⇒ Object
44 45 46 |
# File 'lib/sneakers_handlers/retry_handler.rb', line 44 def error(hdr, props, msg, err) (hdr, props, msg, err.inspect) end |
#noop(_hdr, _props, _msg) ⇒ Object
52 53 |
# File 'lib/sneakers_handlers/retry_handler.rb', line 52 def noop(_hdr, _props, _msg) end |
#reject(hdr, props, msg, requeue = false) ⇒ Object
40 41 42 |
# File 'lib/sneakers_handlers/retry_handler.rb', line 40 def reject(hdr, props, msg, requeue = false) (hdr, props, msg, :reject) end |
#timeout(hdr, props, msg) ⇒ Object
48 49 50 |
# File 'lib/sneakers_handlers/retry_handler.rb', line 48 def timeout(hdr, props, msg) (hdr, props, msg, :timeout) end |