Sha256: 3e9c2d4128a25ff830e425e649ad2f7656e80d657a21785e1bd514aa13c5358f
Contents?: true
Size: 1.42 KB
Versions: 4
Compression:
Stored size: 1.42 KB
Contents
module Kafka module Protocol # The replica id of non-brokers is always -1. REPLICA_ID = -1 APIS = { 0 => :produce, 1 => :fetch, 2 => :list_offset, 3 => :topic_metadata, } ERRORS = { -1 => UnknownError, 1 => OffsetOutOfRange, 2 => CorruptMessage, 3 => UnknownTopicOrPartition, 4 => InvalidMessageSize, 5 => LeaderNotAvailable, 6 => NotLeaderForPartition, 7 => RequestTimedOut, 8 => BrokerNotAvailable, 9 => ReplicaNotAvailable, 10 => MessageSizeTooLarge, 12 => OffsetMetadataTooLarge, 17 => InvalidTopic, 18 => RecordListTooLarge, 19 => NotEnoughReplicas, 20 => NotEnoughReplicasAfterAppend, 21 => InvalidRequiredAcks, } def self.handle_error(error_code) if error_code == 0 # No errors, yay! elsif error = ERRORS[error_code] raise error else raise UnknownError, "Unknown error with code #{error_code}" end end def self.api_name(api_key) APIS.fetch(api_key, :unknown) end end end require "kafka/protocol/topic_metadata_request" require "kafka/protocol/metadata_response" require "kafka/protocol/produce_request" require "kafka/protocol/produce_response" require "kafka/protocol/fetch_request" require "kafka/protocol/fetch_response" require "kafka/protocol/list_offset_request" require "kafka/protocol/list_offset_response"
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ruby-kafka-0.1.7 | lib/kafka/protocol.rb |
ruby-kafka-0.1.6 | lib/kafka/protocol.rb |
ruby-kafka-0.1.5 | lib/kafka/protocol.rb |
ruby-kafka-0.1.4 | lib/kafka/protocol.rb |