Sha256: 3bf66d974a17c5a78fd58bf96248730b899c7befeb428e1a4c962343f9a775e0

Contents?: true

Size: 1.14 KB

Versions: 24

Compression:

Stored size: 1.14 KB

Contents

module Kafka
  module Protocol
    class OffsetCommitRequest
      # This value signals to the broker that its default configuration should be used.
      DEFAULT_RETENTION_TIME = -1

      def api_key
        8
      end

      def api_version
        2
      end

      def response_class
        OffsetCommitResponse
      end

      def initialize(group_id:, generation_id:, member_id:, retention_time: DEFAULT_RETENTION_TIME, offsets:)
        @group_id = group_id
        @generation_id = generation_id
        @member_id = member_id
        @retention_time = retention_time
        @offsets = offsets
      end

      def encode(encoder)
        encoder.write_string(@group_id)
        encoder.write_int32(@generation_id)
        encoder.write_string(@member_id)
        encoder.write_int64(@retention_time)

        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)
            encoder.write_string(nil) # metadata
          end
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
ruby-kafka-0.4.0.beta1 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.3.18.beta2 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.3.18.beta1 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.3.17 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.3.16 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.3.16.beta2 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.3.16.beta1 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.3.15 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.3.15.beta3 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.3.15.beta2 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.3.15.beta1 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.3.14 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.3.13.beta4 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.3.13.beta3 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.3.13.beta2 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.3.13.beta1 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.3.12 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.3.11 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.3.10 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.3.9 lib/kafka/protocol/offset_commit_request.rb