Sha256: 46a010e535a243ae9814134d0d9bda15e1d0fc8527e51b49e337585ab0d67ab7

Contents?: true

Size: 632 Bytes

Versions: 8

Compression:

Stored size: 632 Bytes

Contents

# frozen_string_literal: true

require_relative "message_context"
require "kiev/request_id"
require "kiev/context_reader"

module Kiev
  module Kafka
    class ContextExtractor
      include Kiev::RequestId::Mixin

      # @param [Kafka::FetchedMessage] message
      def call(message)
        context = Kiev::Kafka::MessageContext.new(message)
        context_reader = Kiev::ContextReader.new(context)
        wrap_request_id(context_reader) {}

        Kiev[:message_key] = message.key

        Config.instance.jobs_propagated_fields.each do |key|
          Kiev[key] = context_reader[key]
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
kiev-4.9.0 lib/kiev/kafka/context_extractor.rb
kiev-4.8.3 lib/kiev/kafka/context_extractor.rb
kiev-4.8.2 lib/kiev/kafka/context_extractor.rb
kiev-4.8.1 lib/kiev/kafka/context_extractor.rb
kiev-4.8.0 lib/kiev/kafka/context_extractor.rb
kiev-4.7.0 lib/kiev/kafka/context_extractor.rb
kiev-4.6.0 lib/kiev/kafka/context_extractor.rb
kiev-4.5.0 lib/kiev/kafka/context_extractor.rb