Sha256: 555dd324e69d980d12bd96d4f8daba36ac98687683262e7eaa6df7c55b8fced7

Contents?: true

Size: 1.16 KB

Versions: 26

Compression:

Stored size: 1.16 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
        OFFSET_COMMIT_API
      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

26 entries across 26 versions & 1 rubygems

Version Path
ruby-kafka-0.6.0.beta4 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.6.0.beta3 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.6.0.beta2 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.6.0.beta1 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.5.5 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.5.4 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.5.4.beta1 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.5.3 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.5.2 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.5.2.beta3 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.5.2.beta2 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.5.2.beta1 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.5.1 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.5.1.beta2 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.5.1.beta1 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.4.4 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.5.0 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.5.0.beta6 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.5.0.beta5 lib/kafka/protocol/offset_commit_request.rb
ruby-kafka-0.5.0.beta4 lib/kafka/protocol/offset_commit_request.rb