Sha256: b265a8887947866863af2b15fe000845334c543ca57a8312af928a18f2b7e190

Contents?: true

Size: 1.14 KB

Versions: 18

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

module Kafka
  module Protocol
    class TxnOffsetCommitRequest

      def api_key
        TXN_OFFSET_COMMIT_API
      end

      def api_version
        2
      end

      def response_class
        TxnOffsetCommitResponse
      end

      def initialize(transactional_id:, group_id:, producer_id:, producer_epoch:, offsets:)
        @transactional_id = transactional_id
        @producer_id = producer_id
        @producer_epoch = producer_epoch
        @group_id = group_id
        @offsets = offsets
      end

      def encode(encoder)
        encoder.write_string(@transactional_id.to_s)
        encoder.write_string(@group_id)
        encoder.write_int64(@producer_id)
        encoder.write_int16(@producer_epoch)

        encoder.write_array(@offsets) do |topic, partitions|
          encoder.write_string(topic)
          encoder.write_array(partitions) do |partition, offset|
            encoder.write_int32(partition)
            encoder.write_int64(offset[:offset])
            encoder.write_string(nil) # metadata
            encoder.write_int32(offset[:leader_epoch])
          end
        end
      end

    end
  end
end

Version data entries

18 entries across 18 versions & 3 rubygems

Version Path
ruby-kafka-1.5.0 lib/kafka/protocol/txn_offset_commit_request.rb
ruby-kafka-aws-iam-1.4.5 lib/kafka/protocol/txn_offset_commit_request.rb
ruby-kafka-aws-iam-1.4.4 lib/kafka/protocol/txn_offset_commit_request.rb
ruby-kafka-aws-iam-1.4.3 lib/kafka/protocol/txn_offset_commit_request.rb
ruby-kafka-aws-iam-1.4.2 lib/kafka/protocol/txn_offset_commit_request.rb
ruby-kafka-aws-iam-1.4.1 lib/kafka/protocol/txn_offset_commit_request.rb
ruby-kafka-1.4.0 lib/kafka/protocol/txn_offset_commit_request.rb
ruby-kafka-temp-fork-0.0.2 lib/kafka/protocol/txn_offset_commit_request.rb
ruby-kafka-temp-fork-0.0.1 lib/kafka/protocol/txn_offset_commit_request.rb
ruby-kafka-1.3.0 lib/kafka/protocol/txn_offset_commit_request.rb
ruby-kafka-1.2.0 lib/kafka/protocol/txn_offset_commit_request.rb
ruby-kafka-1.1.0 lib/kafka/protocol/txn_offset_commit_request.rb
ruby-kafka-1.1.0.beta1 lib/kafka/protocol/txn_offset_commit_request.rb
ruby-kafka-1.0.0 lib/kafka/protocol/txn_offset_commit_request.rb
ruby-kafka-0.7.10 lib/kafka/protocol/txn_offset_commit_request.rb
ruby-kafka-0.7.9 lib/kafka/protocol/txn_offset_commit_request.rb
ruby-kafka-0.7.8 lib/kafka/protocol/txn_offset_commit_request.rb
ruby-kafka-0.7.7 lib/kafka/protocol/txn_offset_commit_request.rb