Class: CycloneLariat::Outbox::Services::Resend

Inherits:
Object
  • Object
show all
Extended by:
LunaPark::Extensions::Callable
Includes:
LunaPark::Extensions::Injector
Defined in:
lib/cyclone_lariat/plugins/outbox/services/resend.rb

Instance Method Summary collapse

Instance Method Details

#callObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/cyclone_lariat/plugins/outbox/services/resend.rb', line 19

def call
  messages_repo.each_with_error do |message|
    messages_repo.transaction do
      begin
        messages_repo.lock(message.uuid)
        sns_client.publish message, fifo: message.fifo?
        messages_repo.delete(message.uuid)
      rescue StandardError => e
        messages_repo.update_error(message.uuid, e.message)
        on_sending_error&.call(message, e)
      end
    end
  end
end