Sha256: b4ad1b80e8e2368db7f4ef08a99e519c1e0fd9965a2d5a055222bd2f48abf065

Contents?: true

Size: 959 Bytes

Versions: 8

Compression:

Stored size: 959 Bytes

Contents

module Kafka
  module Protocol

    class CreatePartitionsRequest
      def initialize(topics:, timeout:)
        @topics, @timeout = topics, timeout
      end

      def api_key
        CREATE_PARTITIONS_API
      end

      def api_version
        0
      end

      def response_class
        Protocol::CreatePartitionsResponse
      end

      def encode(encoder)
        encoder.write_array(@topics) do |topic, count, assignments|
          encoder.write_string(topic)
          encoder.write_int32(count)
          encoder.write_array(assignments) do |assignment|
            encoder.write_array(assignment) do |broker|
              encoder.write_int32(broker)
            end
          end
        end
        # Timeout is in ms.
        encoder.write_int32(@timeout * 1000)
        # validate_only. There isn't any use case for this in real life. So
        # let's ignore it for now
        encoder.write_boolean(false)
      end
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ruby-kafka-0.6.0.beta4 lib/kafka/protocol/create_partitions_request.rb
ruby-kafka-0.6.0.beta3 lib/kafka/protocol/create_partitions_request.rb
ruby-kafka-0.6.0.beta2 lib/kafka/protocol/create_partitions_request.rb
ruby-kafka-0.6.0.beta1 lib/kafka/protocol/create_partitions_request.rb
ruby-kafka-0.5.5 lib/kafka/protocol/create_partitions_request.rb
ruby-kafka-0.5.4 lib/kafka/protocol/create_partitions_request.rb
ruby-kafka-0.5.4.beta1 lib/kafka/protocol/create_partitions_request.rb
ruby-kafka-0.5.3 lib/kafka/protocol/create_partitions_request.rb