Sha256: 3411137fa4f295e33c234dcacc48576de4953a781dc888417db179dc0606ff69

Contents?: true

Size: 842 Bytes

Versions: 1

Compression:

Stored size: 842 Bytes

Contents

module Kafka
  module Protocol
    PRODUCE_API_KEY = 0
    TOPIC_METADATA_API_KEY = 3

    def self.handle_error(error_code)
      case error_code
      when -1 then raise UnknownError
      when 0 then nil # no error, yay!
      when 1 then raise OffsetOutOfRange
      when 2 then raise CorruptMessage
      when 3 then raise UnknownTopicOrPartition
      when 4 then raise InvalidMessageSize
      when 5 then raise LeaderNotAvailable
      when 6 then raise NotLeaderForPartition
      when 7 then raise RequestTimedOut
      when 9 then raise ReplicaNotAvailable
      else raise UnknownError, "Unknown error with code #{error_code}"
      end
    end
  end
end

require "kafka/protocol/topic_metadata_request"
require "kafka/protocol/metadata_response"
require "kafka/protocol/produce_request"
require "kafka/protocol/produce_response"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-kafka-0.1.0.pre.beta1 lib/kafka/protocol.rb