Sha256: 653f849fd01cb8d11caac8c2b2f8674289c82a262f5b6357f212d14987c82ec5

Contents?: true

Size: 679 Bytes

Versions: 7

Compression:

Stored size: 679 Bytes

Contents

module Telekinesis
  module Producer
    # A simple FailureHandler that logs errors with `warn`. Available as an
    # example and an easy default.
    class WarnFailureHandler
      def on_record_failure(item_err_pairs)
        warn "Puts for #{item_err_pairs.size} records failed!"
      end

      # Do nothing on retry. Let it figure itself out.
      def on_kinesis_retry(err, items); end

      def on_kinesis_failure(err, items)
        warn "PutRecords request with #{items.size} items failed!"
        warn format_bt(err)
      end

      protected

      def format_bt(e)
        e.backtrace ? e.backtrace.map{|l| "!  #{l}"}.join("\n") : ""
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
telekinesis-3.2.1-java lib/telekinesis/producer/warn_failure_handler.rb
telekinesis-3.2.0-java lib/telekinesis/producer/warn_failure_handler.rb
telekinesis-3.1.1-java lib/telekinesis/producer/warn_failure_handler.rb
telekinesis-3.1.0-java lib/telekinesis/producer/warn_failure_handler.rb
telekinesis-3.0.0-java lib/telekinesis/producer/warn_failure_handler.rb
telekinesis-2.0.1-java lib/telekinesis/producer/warn_failure_handler.rb
telekinesis-2.0.0-java lib/telekinesis/producer/warn_failure_handler.rb