Class: Karafka::Deserializers::Payload

Inherits:
Object
  • Object
show all
Defined in:
lib/karafka/deserializers/payload.rb

Overview

Default Karafka Json deserializer for loading JSON data in payload.

Instance Method Summary collapse

Instance Method Details

#call(message) ⇒ Hash

Returns hash with deserialized JSON data.

Parameters:

Returns:

  • (Hash)

    hash with deserialized JSON data



10
11
12
13
# File 'lib/karafka/deserializers/payload.rb', line 10

def call(message)
  # nil payload can be present for example for tombstone messages
  message.raw_payload.nil? ? nil : ::JSON.parse(message.raw_payload)
end