Class: Barbeque::MessageRetryingService
- Inherits:
-
Object
- Object
- Barbeque::MessageRetryingService
- Defined in:
- app/services/barbeque/message_retrying_service.rb
Constant Summary collapse
- DEFAULT_DELAY_SECONDS =
0
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message_id:, delay_seconds: nil) ⇒ MessageRetryingService
constructor
A new instance of MessageRetryingService.
- #run ⇒ Object
Constructor Details
#initialize(message_id:, delay_seconds: nil) ⇒ MessageRetryingService
Returns a new instance of MessageRetryingService.
10 11 12 13 |
# File 'app/services/barbeque/message_retrying_service.rb', line 10 def initialize(message_id:, delay_seconds: nil) @message_id = @delay_seconds = delay_seconds || DEFAULT_DELAY_SECONDS end |
Class Method Details
.sqs_client ⇒ Object
6 7 8 |
# File 'app/services/barbeque/message_retrying_service.rb', line 6 def self.sqs_client @sqs_client ||= Aws::SQS::Client.new end |
Instance Method Details
#run ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'app/services/barbeque/message_retrying_service.rb', line 15 def run execution = Barbeque::JobExecution.find_by!(message_id: @message_id) Barbeque::MessageRetryingService.sqs_client.( queue_url: execution.job_queue.queue_url, message_body: .to_json, delay_seconds: @delay_seconds, ) end |