Sha256: e4e8cd90b1a3a84765ac4f409d36806fb5914c040228d2f873e60339af5abb70

Contents?: true

Size: 566 Bytes

Versions: 15

Compression:

Stored size: 566 Bytes

Contents

# frozen_string_literal: true

module Karafka
  # Module for all supported by default deserializers.
  module Deserializers
    # Default Karafka Json deserializer for loading JSON data in payload.
    class Payload
      # @param message [Karafka::Messages::Message] Message object that we want to deserialize
      # @return [Hash] hash with deserialized JSON data
      def call(message)
        # nil payload can be present for example for tombstone messages
        message.raw_payload.nil? ? nil : ::JSON.parse(message.raw_payload)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
karafka-2.4.13 lib/karafka/deserializers/payload.rb
karafka-2.4.12 lib/karafka/deserializers/payload.rb
karafka-2.4.11 lib/karafka/deserializers/payload.rb
karafka-2.4.10 lib/karafka/deserializers/payload.rb
karafka-2.4.9 lib/karafka/deserializers/payload.rb
karafka-2.4.8 lib/karafka/deserializers/payload.rb
karafka-2.4.7 lib/karafka/deserializers/payload.rb
karafka-2.4.6 lib/karafka/deserializers/payload.rb
karafka-2.4.5 lib/karafka/deserializers/payload.rb
karafka-2.4.4 lib/karafka/deserializers/payload.rb
karafka-2.4.3 lib/karafka/deserializers/payload.rb
karafka-2.4.0 lib/karafka/deserializers/payload.rb
karafka-2.4.0.rc1 lib/karafka/deserializers/payload.rb
karafka-2.4.0.beta2 lib/karafka/deserializers/payload.rb
karafka-2.4.0.beta1 lib/karafka/deserializers/payload.rb