Sha256: a92dcb565f3e832937eb741fb301a2939c09d17c2e46a0e5405e14ea67a1a27f

Contents?: true

Size: 619 Bytes

Versions: 1

Compression:

Stored size: 619 Bytes

Contents

# frozen_string_literal: true

module PhobosDBCheckpoint
  class RetryFailure
    include PhobosDBCheckpoint::Handler

    def initialize(failure)
      @failure = failure
      @action_taken = nil
    end

    def perform
      around_consume(payload, metadata) do
        @action_taken = handler.consume(payload, metadata)
      end

      @failure.destroy
      @action_taken
    end

    private

    def payload
      @failure.payload.to_json
    end

    def metadata
      @failure.metadata.merge(retry_count: 0)
    end

    def handler
      @failure
        .configured_handler
        .new
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
phobos_db_checkpoint-3.4.0 lib/phobos_db_checkpoint/actions/retry_failure.rb