Class: AwsSqsMoniter::DeadLetters::Retrier
- Inherits:
-
Object
- Object
- AwsSqsMoniter::DeadLetters::Retrier
- Defined in:
- lib/aws_sqs_moniter/dead_letters/retrier.rb
Instance Method Summary collapse
-
#initialize(logger = nil) ⇒ Retrier
constructor
A new instance of Retrier.
- #retry(scope) ⇒ Object
Constructor Details
#initialize(logger = nil) ⇒ Retrier
Returns a new instance of Retrier.
4 5 6 7 |
# File 'lib/aws_sqs_moniter/dead_letters/retrier.rb', line 4 def initialize logger = nil @publisher = AwsSqsMoniter::MessagePublisher.new @logger = logger || Shoryuken::Logging.logger end |
Instance Method Details
#retry(scope) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/aws_sqs_moniter/dead_letters/retrier.rb', line 9 def retry scope return if scope.count == 0 count = 0 scope.each do || count += 1 @publisher.publish . .delete end @logger.info "Retried #{count} dead letter(s)." end |