Class: MicroQ::Middleware::Server::Retry
- Inherits:
-
Object
- Object
- MicroQ::Middleware::Server::Retry
- Includes:
- Util
- Defined in:
- lib/micro_q/middleware/server/retry.rb
Overview
Capture, re-raise and potentially push a modified message back onto the queue. We add metadata about the retry into the ‘retried’ key to track the attempts.
count: The number of retires thus far at: When the last retry occurred when: The time at which the message will be retried again
Constant Summary collapse
- RETRY =
proc {|klass| klass ? "messages:#{klass}:retry" : 'messages:retry' }
Instance Method Summary collapse
Methods included from Util
Instance Method Details
#call(worker, message) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/micro_q/middleware/server/retry.rb', line 18 def call(worker, ) yield rescue Exception => e raise e unless ['retry'] retried!() stats() unless ['retried']['count'] > retry_count() MicroQ.push(, ['retried']) end raise e end |