Sha256: cc985cd2da3dbb464691dd9b5be4cc2d23e14343c4a4c32971bac5a445054f23

Contents?: true

Size: 621 Bytes

Versions: 9

Compression:

Stored size: 621 Bytes

Contents

module PhobosDBCheckpoint
  class RetryFailure
    include PhobosDBCheckpoint::Handler

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

    def perform
      self
        .class
        .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

9 entries across 9 versions & 1 rubygems

Version Path
phobos_db_checkpoint-3.3.0 lib/phobos_db_checkpoint/actions/retry_failure.rb
phobos_db_checkpoint-3.2.0 lib/phobos_db_checkpoint/actions/retry_failure.rb
phobos_db_checkpoint-3.1.0 lib/phobos_db_checkpoint/actions/retry_failure.rb
phobos_db_checkpoint-3.0.0 lib/phobos_db_checkpoint/actions/retry_failure.rb
phobos_db_checkpoint-2.4.0 lib/phobos_db_checkpoint/actions/retry_failure.rb
phobos_db_checkpoint-2.3.1 lib/phobos_db_checkpoint/actions/retry_failure.rb
phobos_db_checkpoint-2.3.0 lib/phobos_db_checkpoint/actions/retry_failure.rb
phobos_db_checkpoint-2.2.0 lib/phobos_db_checkpoint/actions/retry_failure.rb
phobos_db_checkpoint-2.1.0 lib/phobos_db_checkpoint/actions/retry_failure.rb