Sha256: bf00afd6dc5110e747e2221abff62ecac50693f4da35ffbf195a4717b8b82a15

Contents?: true

Size: 1.33 KB

Versions: 8

Compression:

Stored size: 1.33 KB

Contents

# frozen_string_literal: true

# This Karafka component is a Pro component under a commercial license.
# This Karafka component is NOT licensed under LGPL.
#
# All of the commercial components are present in the lib/karafka/pro directory of this
# repository and their usage requires commercial license agreement.
#
# Karafka has also commercial-friendly license, commercial support and commercial components.
#
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
# your code to Maciej Mensfeld.

module Karafka
  module Pro
    module RecurringTasks
      # Recurring Tasks data deserializer. We compress data ourselves because we cannot rely on
      # any external optional features like certain compression types, etc. By doing this that way
      # we can ensure we have full control over the compression.
      #
      # @note We use `symbolize_names` because we want to use the same convention of hash building
      #   for producing, consuming and displaying related data as in other places.
      class Deserializer
        # @param message [::Karafka::Messages::Message]
        # @return [Hash] deserialized data
        def call(message)
          ::JSON.parse(
            Zlib::Inflate.inflate(message.raw_payload),
            symbolize_names: true
          )
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
karafka-2.4.16 lib/karafka/pro/recurring_tasks/deserializer.rb
karafka-2.4.15 lib/karafka/pro/recurring_tasks/deserializer.rb
karafka-2.4.14 lib/karafka/pro/recurring_tasks/deserializer.rb
karafka-2.4.13 lib/karafka/pro/recurring_tasks/deserializer.rb
karafka-2.4.12 lib/karafka/pro/recurring_tasks/deserializer.rb
karafka-2.4.11 lib/karafka/pro/recurring_tasks/deserializer.rb
karafka-2.4.10 lib/karafka/pro/recurring_tasks/deserializer.rb
karafka-2.4.9 lib/karafka/pro/recurring_tasks/deserializer.rb