Sha256: edf7cdf1c386a0fe7fd238f6dba53ed15fb812d529ee0e41b9651c0047f0c226

Contents?: true

Size: 990 Bytes

Versions: 49

Compression:

Stored size: 990 Bytes

Contents

# frozen_string_literal: true

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

49 entries across 49 versions & 4 rubygems

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