Sha256: 3fc60335b381fec169c59b9a914e9a0cea23cadfe48714d8e4a45755c2072333

Contents?: true

Size: 571 Bytes

Versions: 19

Compression:

Stored size: 571 Bytes

Contents

# frozen_string_literal: true

module Sbmt
  module KafkaConsumer
    module Serialization
      class JsonDeserializer < BaseDeserializer
        def call(message)
          # nil payload can be present for example for tombstone messages
          message.raw_payload.nil? ? nil : ::JSON.parse(message.raw_payload)
        rescue JSON::ParserError => e
          raise Sbmt::KafkaConsumer::SkipUndeserializableMessage, "cannot decode message: #{e.message}, payload: #{message.raw_payload}" if skip_decoding_error

          raise
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
sbmt-kafka_consumer-3.3.0 lib/sbmt/kafka_consumer/serialization/json_deserializer.rb
sbmt-kafka_consumer-3.2.2 lib/sbmt/kafka_consumer/serialization/json_deserializer.rb
sbmt-kafka_consumer-3.2.1 lib/sbmt/kafka_consumer/serialization/json_deserializer.rb
sbmt-kafka_consumer-3.2.0 lib/sbmt/kafka_consumer/serialization/json_deserializer.rb
sbmt-kafka_consumer-3.1.0 lib/sbmt/kafka_consumer/serialization/json_deserializer.rb
sbmt-kafka_consumer-2.8.0 lib/sbmt/kafka_consumer/serialization/json_deserializer.rb
sbmt-kafka_consumer-3.0.0 lib/sbmt/kafka_consumer/serialization/json_deserializer.rb
sbmt-kafka_consumer-2.7.1 lib/sbmt/kafka_consumer/serialization/json_deserializer.rb
sbmt-kafka_consumer-2.7.0 lib/sbmt/kafka_consumer/serialization/json_deserializer.rb
sbmt-kafka_consumer-2.6.1 lib/sbmt/kafka_consumer/serialization/json_deserializer.rb
sbmt-kafka_consumer-2.6.0 lib/sbmt/kafka_consumer/serialization/json_deserializer.rb
sbmt-kafka_consumer-2.5.0 lib/sbmt/kafka_consumer/serialization/json_deserializer.rb
sbmt-kafka_consumer-2.4.1 lib/sbmt/kafka_consumer/serialization/json_deserializer.rb
sbmt-kafka_consumer-2.4.0 lib/sbmt/kafka_consumer/serialization/json_deserializer.rb
sbmt-kafka_consumer-2.3.1 lib/sbmt/kafka_consumer/serialization/json_deserializer.rb
sbmt-kafka_consumer-2.3.0 lib/sbmt/kafka_consumer/serialization/json_deserializer.rb
sbmt-kafka_consumer-2.2.0 lib/sbmt/kafka_consumer/serialization/json_deserializer.rb
sbmt-kafka_consumer-2.1.0 lib/sbmt/kafka_consumer/serialization/json_deserializer.rb
sbmt-kafka_consumer-2.0.0 lib/sbmt/kafka_consumer/serialization/json_deserializer.rb