File Coverage

lib/Kafka.pm
Criterion Covered Total %
statement 17 17 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 23 23 100.0


line stmt bran cond sub pod time code
1             package Kafka;
2              
3             # Kafka allows you to produce and consume messages using
4             # the Apache Kafka distributed publish/subscribe messaging service.
5              
6             =head1 NAME
7              
8             Kafka - Apache Kafka interface for Perl.
9              
10             =head1 VERSION
11              
12             This documentation refers to C package version 1.06 .
13              
14             =cut
15              
16              
17              
18 17     17   2327276 use 5.010;
  17         78  
19 17     17   118 use strict;
  17         37  
  17         454  
20 17     17   100 use warnings;
  17         44  
  17         887  
21              
22              
23              
24             our $VERSION = '1.06';
25              
26 17         2786 use Exporter qw(
27             import
28 17     17   113 );
  17         37  
29              
30             our @EXPORT_OK = qw(
31             $BITS64
32             $BLOCK_UNTIL_IS_COMMITTED
33             $COMPRESSION_GZIP
34             $COMPRESSION_NONE
35             $COMPRESSION_SNAPPY
36             $DEFAULT_MAX_BYTES
37             $DEFAULT_MAX_NUMBER_OF_OFFSETS
38             $DEFAULT_MAX_WAIT_TIME
39             %ERROR
40             $ERROR_BROKER_NOT_AVAILABLE
41             $ERROR_CANNOT_BIND
42             $ERROR_CANNOT_GET_METADATA
43             $ERROR_CANNOT_RECV
44             $ERROR_CANNOT_SEND
45             $ERROR_COMPRESSION
46             $ERROR_CONSUMER_COORDINATOR_NOT_AVAILABLE_CODE
47             $ERROR_GROUP_COORDINATOR_NOT_AVAILABLE
48             $ERROR_GROUP_COORDINATOR_NOT_AVAILABLE_CODE
49             $ERROR_INVALID_MESSAGE
50             $ERROR_CORRUPT_MESSAGE
51             $ERROR_INVALID_FETCH_SIZE
52             $ERROR_INVALID_MESSAGE_SIZE
53             $ERROR_LEADER_NOT_AVAILABLE
54             $ERROR_LEADER_NOT_FOUND
55             $ERROR_GROUP_COORDINATOR_NOT_FOUND
56             $ERROR_LOAD_IN_PROGRESS_CODE
57             $ERROR_GROUP_LOAD_IN_PROGRESS
58             $ERROR_GROUP_LOAD_IN_PROGRESS_CODE
59             $ERROR_MESSAGE_SIZE_TOO_LARGE
60             $ERROR_MESSAGE_TOO_LARGE
61             $ERROR_NETWORK_EXCEPTION
62             $ERROR_METADATA_ATTRIBUTES
63             $ERROR_MISMATCH_ARGUMENT
64             $ERROR_MISMATCH_CORRELATIONID
65             $ERROR_NO_CONNECTION
66             $ERROR_NO_ERROR
67             $ERROR_NO_KNOWN_BROKERS
68             $ERROR_NOT_BINARY_STRING
69             $ERROR_NOT_LEADER_FOR_PARTITION
70             $ERROR_NOT_COORDINATOR_FOR_CONSUMER_CODE
71             $ERROR_NOT_COORDINATOR_FOR_GROUP
72             $ERROR_NOT_COORDINATOR_FOR_GROUP_CODE
73             $ERROR_OFFSET_METADATA_TOO_LARGE
74             $ERROR_OFFSET_METADATA_TOO_LARGE_CODE
75             $ERROR_OFFSET_OUT_OF_RANGE
76             $ERROR_PARTITION_DOES_NOT_MATCH
77             $ERROR_REPLICA_NOT_AVAILABLE
78             $ERROR_REQUEST_OR_RESPONSE
79             $ERROR_REQUEST_TIMED_OUT
80             $ERROR_RESPONSEMESSAGE_NOT_RECEIVED
81             $ERROR_INCOMPATIBLE_HOST_IP_VERSION
82             $ERROR_SEND_NO_ACK
83             $ERROR_STALE_CONTROLLER_EPOCH
84             $ERROR_STALE_CONTROLLER_EPOCH_CODE
85             $ERROR_TOPIC_DOES_NOT_MATCH
86             $ERROR_UNKNOWN
87             $ERROR_UNKNOWN_APIKEY
88             $ERROR_UNKNOWN_TOPIC_OR_PARTITION
89             $ERROR_INVALID_TOPIC_CODE
90             $ERROR_INVALID_TOPIC_EXCEPTION
91             $ERROR_RECORD_LIST_TOO_LARGE
92             $ERROR_RECORD_LIST_TOO_LARGE_CODE
93             $ERROR_NOT_ENOUGH_REPLICAS
94             $ERROR_NOT_ENOUGH_REPLICAS_CODE
95             $ERROR_NOT_ENOUGH_REPLICAS_AFTER_APPEND
96             $ERROR_NOT_ENOUGH_REPLICAS_AFTER_APPEND_CODE
97             $ERROR_INVALID_REQUIRED_ACKS
98             $ERROR_INVALID_REQUIRED_ACKS_CODE
99             $ERROR_ILLEGAL_GENERATION
100             $ERROR_ILLEGAL_GENERATION_CODE
101             $ERROR_INCONSISTENT_GROUP_PROTOCOL
102             $ERROR_INCONSISTENT_GROUP_PROTOCOL_CODE
103             $ERROR_INVALID_GROUP_ID
104             $ERROR_INVALID_GROUP_ID_CODE
105             $ERROR_UNKNOWN_MEMBER_ID
106             $ERROR_UNKNOWN_MEMBER_ID_CODE
107             $ERROR_INVALID_SESSION_TIMEOUT
108             $ERROR_INVALID_SESSION_TIMEOUT_CODE
109             $ERROR_REBALANCE_IN_PROGRESS
110             $ERROR_REBALANCE_IN_PROGRESS_CODE
111             $ERROR_INVALID_COMMIT_OFFSET_SIZE
112             $ERROR_INVALID_COMMIT_OFFSET_SIZE_CODE
113             $ERROR_TOPIC_AUTHORIZATION_FAILED
114             $ERROR_TOPIC_AUTHORIZATION_FAILED_CODE
115             $ERROR_GROUP_AUTHORIZATION_FAILED
116             $ERROR_GROUP_AUTHORIZATION_FAILED_CODE
117             $ERROR_CLUSTER_AUTHORIZATION_FAILED
118             $ERROR_CLUSTER_AUTHORIZATION_FAILED_CODE
119             $ERROR_INVALID_TIMESTAMP
120             $ERROR_UNSUPPORTED_SASL_MECHANISM
121             $ERROR_ILLEGAL_SASL_STATE
122             $ERROR_UNSUPPORTED_VERSION
123             $IP_V4
124             $IP_V6
125             $KAFKA_SERVER_PORT
126             $MESSAGE_SIZE_OVERHEAD
127             $MIN_BYTES_RESPOND_HAS_DATA
128             $MIN_BYTES_RESPOND_IMMEDIATELY
129             $NOT_SEND_ANY_RESPONSE
130             $RECEIVE_EARLIEST_OFFSET
131             $RECEIVE_EARLIEST_OFFSETS
132             $RECEIVE_LATEST_OFFSET
133             $RECEIVE_LATEST_OFFSETS
134             $REQUEST_TIMEOUT
135             $RETRY_BACKOFF
136             $SEND_MAX_ATTEMPTS
137             $WAIT_WRITTEN_TO_LOCAL_LOG
138             );
139              
140              
141              
142 17     17   126 use Config;
  17         39  
  17         799  
143 17     17   4722 use Const::Fast;
  17         22877  
  17         125  
144              
145              
146              
147             =head1 SYNOPSIS
148              
149             use 5.010;
150             use strict;
151             use warnings;
152              
153             use Scalar::Util qw(
154             blessed
155             );
156             use Try::Tiny;
157              
158             use Kafka qw(
159             $BITS64
160             );
161             use Kafka::Connection;
162             use Kafka::Producer;
163             use Kafka::Consumer;
164              
165             # A simple example of Kafka usage
166              
167             # common information
168             say 'This is Kafka package ', $Kafka::VERSION;
169             say 'You have a ', $BITS64 ? '64' : '32', ' bit system';
170              
171             my ( $connection, $producer, $consumer );
172             try {
173              
174             #-- Connect to local cluster
175             $connection = Kafka::Connection->new( host => 'localhost' );
176             #-- Producer
177             $producer = Kafka::Producer->new( Connection => $connection );
178             #-- Consumer
179             $consumer = Kafka::Consumer->new( Connection => $connection );
180              
181             } catch {
182             my $error = $_;
183             if ( blessed( $error ) && $error->isa( 'Kafka::Exception' ) ) {
184             warn 'Error: (', $error->code, ') ', $error->message, "\n";
185             exit;
186             } else {
187             die $error;
188             }
189             };
190              
191             # cleaning up
192             undef $consumer;
193             undef $producer;
194             $connection->close;
195             undef $connection;
196              
197             # another brief code example of the Kafka package
198             # is provided in the "An Example" section.
199              
200             =head1 ABSTRACT
201              
202             The Kafka package is a set of Perl modules which provides a simple and
203             consistent application programming interface (API) to Apache Kafka 0.9+,
204             a high-throughput distributed messaging system.
205              
206             =head1 DESCRIPTION
207              
208             The user modules in this package provide an object oriented API.
209             The IO agents, requests sent, and responses received from the Apache Kafka
210             or mock servers are all represented by objects.
211             This makes a simple and powerful interface to these services.
212              
213             The main features of the package are:
214              
215             =over 3
216              
217             =item *
218              
219             Contains various reusable components (modules) that can be used separately
220             or together.
221              
222             =item *
223              
224             Provides an object oriented model of communication.
225              
226             =item *
227              
228             Supports parsing the Apache Kafka protocol.
229              
230             =item *
231              
232             Supports the Apache Kafka Requests and Responses. Within this package the
233             following implements of Kafka's protocol are implemented: PRODUCE, FETCH,
234             OFFSETS, and METADATA.
235              
236             =item *
237              
238             Simple producer and consumer clients.
239              
240             =item *
241              
242             A simple interface to control the test Kafka server cluster
243             (in the test directory).
244              
245             =item *
246              
247             Simple mock server instance (located in the test directory) for testing without
248             Apache Kafka server.
249              
250             =item *
251              
252             Support for working with 64 bit elements of the Kafka protocol on 32 bit systems.
253              
254             =item *
255              
256             Taint mode support.
257             The input data is not checked for tainted.
258             Returns untainted data.
259              
260             =back
261              
262             =head1 APACHE KAFKA'S STYLE COMMUNICATION
263              
264             The Kafka package is based on Kafka's 0.9+ Protocol specification document at
265             L
266              
267             =over 3
268              
269             =item
270              
271             The Kafka's protocol is based on a request/response paradigm.
272             A client establishes a connection with a server and sends a request to the
273             server in the form of a request method, followed by a messages containing
274             request modifiers. The server responds with a success or error code,
275             followed by a messages containing entity meta-information and content.
276              
277             Messages are the fundamental unit of communication. They are published to
278             a topic by a producer, which means they are physically sent to a server acting
279             as a broker. Some number of consumers subscribe to a topic, and each published
280             message is delivered to all the consumers.
281             The messages stream is partitioned on the brokers as a set of distinct
282             partitions. The semantic meaning of these partitions is left up to the producer
283             and the producer specifies which partition a message belongs to. Within
284             a partition the messages are stored in the order in which they arrive at the
285             broker, and will be given out to consumers in that same order.
286             In Apache Kafka, the consumers are responsible for maintaining state information
287             (offset) on what has been consumed.
288             A consumer can deliberately rewind back to an old offset and re-consume data.
289             Each message is uniquely identified by a 64-bit integer offset giving the
290             position of the start of this message in the stream of all messages ever sent
291             to that topic on that partition.
292             Reads are done by giving the 64-bit logical offset of a message and a max
293             chunk size.
294              
295             The request is then passed through the client to a server and we get the
296             response in return to a consumer request that we can examine.
297             A request is always independent of any previous requests, i.e. the service
298             is stateless.
299             This API is completely stateless, with the topic and partition being passed in
300             on every request.
301              
302             =back
303              
304             =head2 The Connection Object
305              
306             Clients use the Connection object to communicate with the Apache Kafka cluster.
307             The Connection object is an interface layer between your application code and
308             the Apache Kafka cluster.
309              
310             Connection object is required to create instances of classes
311             L or L.
312              
313             Kafka Connection API is implemented by L class.
314              
315             use Kafka::Connection;
316              
317             # connect to local cluster with the defaults
318             my $connection = Kafka::Connection->new( host => 'localhost' );
319              
320             The main attributes of the Connection object are:
321              
322             =over 3
323              
324             =item *
325              
326             B and B are the IO object attributes denoting any server from the Kafka
327             cluster a client wants to connect.
328              
329             =item *
330              
331             B specifies how much time remote servers is given to respond before
332             disconnection occurs and internal exception is thrown.
333              
334             =back
335              
336             =head2 The IO Object
337              
338             The L object use internal class L
339             to maintain communication with the particular server of Kafka cluster
340             The IO object is an interface layer between L object and
341             the network.
342              
343             Kafka IO API is implemented by L class. Note that end user
344             normally should have no need to use L but work with
345             L instead.
346              
347             use Kafka::IO;
348              
349             # connect to local server with the defaults
350             my $io = Kafka::IO->new( host => 'localhost' );
351              
352             The main attributes of the IO object are:
353              
354             =over 3
355              
356             =item *
357              
358             B and B are the IO object attributes denoting the server and
359             the port of Apache Kafka server.
360              
361             =item *
362              
363             B specifies how much time is given remote servers to respond before
364             the IO object disconnects and generates an internal exception.
365              
366             =back
367              
368             =head2 The Producer Object
369              
370             Kafka producer API is implemented by L class.
371              
372             use Kafka::Producer;
373              
374             #-- Producer
375             my $producer = Kafka::Producer->new( Connection => $connection );
376              
377             # Sending a single message
378             $producer->send(
379             'mytopic', # topic
380             0, # partition
381             'Single message' # message
382             );
383              
384             # Sending a series of messages
385             $producer->send(
386             'mytopic', # topic
387             0, # partition
388             [ # messages
389             'The first message',
390             'The second message',
391             'The third message',
392             ]
393             );
394              
395             The main methods and attributes of the producer request are:
396              
397             =over 3
398              
399             =item *
400              
401             The request method of the producer object is C.
402              
403             =item *
404              
405             B and B define respective parameters of the B we
406             want to send.
407              
408             =item *
409              
410             B is an arbitrary amount of data (a simple data string or reference to
411             an array of the data strings).
412              
413             =back
414              
415             =head2 The Consumer Object
416              
417             Kafka consumer API is implemented by L class.
418              
419             use Kafka::Consumer;
420              
421             $consumer = Kafka::Consumer->new( Connection => $connection );
422              
423             The request methods of the consumer object are C and C.
424              
425             C method returns a reference to the list of offsets of received messages.
426              
427             C method returns a reference to the list of received
428             L objects.
429              
430             use Kafka qw(
431             $DEFAULT_MAX_BYTES
432             $DEFAULT_MAX_NUMBER_OF_OFFSETS
433             $RECEIVE_EARLIEST_OFFSET
434             );
435              
436             # Get a list of valid offsets up to max_number before the given time
437             my $offsets = $consumer->offsets(
438             'mytopic', # topic
439             0, # partition
440             $RECEIVE_EARLIEST_OFFSET, # time
441             $DEFAULT_MAX_NUMBER_OF_OFFSETS # max_number
442             );
443             say "Received offset: $_" foreach @$offsets;
444              
445             # Consuming messages
446             my $messages = $consumer->fetch(
447             'mytopic', # topic
448             0, # partition
449             0, # offset
450             $DEFAULT_MAX_BYTES # Maximum size of MESSAGE(s) to receive
451             );
452             foreach my $message ( @$messages ) {
453             if ( $message->valid ) {
454             say 'payload : ', $message->payload;
455             say 'key : ', $message->key;
456             say 'offset : ', $message->offset;
457             say 'next_offset: ', $message->next_offset;
458             } else {
459             say 'error : ', $message->error;
460             }
461             }
462              
463             See L for additional information and documentation about
464             class methods and arguments.
465              
466             =head2 The Message Object
467              
468             Kafka message API is implemented by L class.
469              
470             if ( $message->valid ) {
471             say 'payload : ', $message->payload;
472             say 'key : ', $message->key;
473             say 'offset : ', $message->offset;
474             say 'next_offset: ', $message->next_offset;
475             } else {
476             say 'error : ', $message->error;
477             }
478              
479             Methods available for L object :
480              
481             =over 3
482              
483             =item *
484              
485             C A simple message received from the Apache Kafka server.
486              
487             =item *
488              
489             C An optional message key that was used for partition assignment.
490              
491             =item *
492              
493             C A message entry is valid.
494              
495             =item *
496              
497             C A description of the message inconsistence.
498              
499             =item *
500              
501             C The offset beginning of the message in the Apache Kafka server.
502              
503             =item *
504              
505             C The offset beginning of the next message in the Apache Kafka
506             server.
507              
508             =back
509              
510             =head2 The Exception Object
511              
512             A designated class C is used to provide a more detailed and
513             structured information when error is detected.
514              
515             The following attributes are declared within C:
516             L, L.
517              
518             Additional subclasses of C designed to report errors in respective
519             Kafka classes:
520             C,
521             C,
522             C,
523             C,
524             C.
525              
526             Authors suggest using of L's C and C to handle exceptions while
527             working with Kafka module.
528              
529             =cut
530              
531             =head1 EXPORT
532              
533             None by default.
534              
535             =head2 Additional constants
536              
537             Additional constants are available for import, which can be used to define some
538             type of parameters, and to identify various error cases.
539              
540             =over
541              
542             =item C<$KAFKA_SERVER_PORT>
543              
544             default Apache Kafka server port - 9092.
545              
546             =cut
547             const our $KAFKA_SERVER_PORT => 9092;
548              
549             =item C<$REQUEST_TIMEOUT>
550              
551             1.5 sec - timeout in secs, for C, C, blocking C and
552             C calls (could be any integer or floating-point type).
553              
554             =cut
555             const our $REQUEST_TIMEOUT => 1.5;
556              
557             # Important configuration properties
558              
559             =item C<$DEFAULT_MAX_BYTES>
560              
561             1MB - maximum size of message(s) to receive.
562              
563             =cut
564             const our $DEFAULT_MAX_BYTES => 1_000_000;
565              
566             =item C<$SEND_MAX_ATTEMPTS>
567              
568             4 - The leader may be unavailable transiently, which can fail the sending of a message.
569             This property specifies the number of attempts to send of a message.
570              
571             Do not use C<$Kafka::SEND_MAX_ATTEMPTS> in Csend> request to prevent duplicates.
572              
573             =cut
574             const our $SEND_MAX_ATTEMPTS => 4;
575              
576             =item C<$RETRY_BACKOFF>
577              
578             200 - (ms)
579              
580             According to Apache Kafka documentation:
581              
582             Producer Configs -
583             Before each retry, the producer refreshes the metadata of relevant topics.
584             Since leader election takes a bit of time, this property specifies the amount of time
585             that the producer waits before refreshing the metadata.
586              
587             Consumer Configs -
588             Backoff time to wait before trying to determine the leader of a partition that has just lost its leader.
589              
590             =cut
591             const our $RETRY_BACKOFF => 200;
592              
593             # Used to ask for all messages before a certain time (ms). There are two special values.
594              
595             =item C<$RECEIVE_LATEST_OFFSET>
596              
597             B: please use C<$RECEIVE_LATEST_OFFSETS>, as when using this
598             constant to retrieve offsets, you can get more than one. It's kept for backward
599             compatibility.
600              
601             -1 : special value that denotes latest available offset.
602              
603             =cut
604             const our $RECEIVE_LATEST_OFFSET => -1; # deprecated, this may return multiple offsets, so the naming is wrong).
605              
606             =item C<$RECEIVE_LATEST_OFFSETS>
607              
608             -1 : special value that denotes latest available offsets.
609              
610             =cut
611             const our $RECEIVE_LATEST_OFFSETS => -1; # to receive the latest offsets.
612              
613             =item C<$RECEIVE_EARLIEST_OFFSET>
614              
615             -2 : special value that denotes earliest available offset.
616              
617             =cut
618             const our $RECEIVE_EARLIEST_OFFSET => -2;
619              
620             =item C<$RECEIVE_EARLIEST_OFFSETS>
621              
622             B: please use C<$RECEIVE_EARLIEST_OFFSET>, as when using this
623             constant to retrieve offset, you can get only one. It's kept for backward
624             compatibility.
625              
626             -2 : special value that denotes earliest available offset.
627              
628             =cut
629             const our $RECEIVE_EARLIEST_OFFSETS => -2;
630              
631             =item C<$DEFAULT_MAX_NUMBER_OF_OFFSETS>
632              
633             100 - maximum number of offsets to retrieve.
634              
635             =cut
636             const our $DEFAULT_MAX_NUMBER_OF_OFFSETS => 100;
637              
638             =item C<$MIN_BYTES_RESPOND_IMMEDIATELY>
639              
640             The minimum number of bytes of messages that must be available to give a response.
641              
642             0 - the server will always respond immediately.
643              
644             =cut
645             const our $MIN_BYTES_RESPOND_IMMEDIATELY => 0;
646              
647             =item C<$MIN_BYTES_RESPOND_HAS_DATA>
648              
649             The minimum number of bytes of messages that must be available to give a response.
650              
651             10 - the server will respond as soon as at least one partition has at least 10 bytes of data
652             (Offset => int64 + MessageSize => int32)
653             or the specified timeout occurs.
654              
655             =cut
656             const our $MIN_BYTES_RESPOND_HAS_DATA => 10;
657              
658             =item C<$NOT_SEND_ANY_RESPONSE>
659              
660             Indicates how many acknowledgements the servers should receive before responding to the request.
661              
662             0 - the server does not send any response.
663              
664             =cut
665             const our $NOT_SEND_ANY_RESPONSE => 0;
666              
667             =item C<$WAIT_WRITTEN_TO_LOCAL_LOG>
668              
669             Indicates how long the servers should wait for the data to be written to the local long before responding to the request.
670              
671             1 - the server will wait the data is written to the local log before sending a response.
672              
673             =cut
674             const our $WAIT_WRITTEN_TO_LOCAL_LOG => 1;
675              
676             =item C<$BLOCK_UNTIL_IS_COMMITTED>
677              
678             Wait for message to be committed by all sync replicas.
679              
680             -1 - the server will block until the message is committed by all in sync replicas before sending a response.
681              
682             =cut
683             const our $BLOCK_UNTIL_IS_COMMITTED => -1;
684              
685             =item C<$DEFAULT_MAX_WAIT_TIME>
686              
687             The maximum amount of time (seconds, may be fractional) to wait when no sufficient amount of data is available
688             at the time the request is dispatched.
689              
690             0.1 - allow the server to wait up to 0.1s to try to accumulate data before responding.
691              
692             =cut
693             const our $DEFAULT_MAX_WAIT_TIME => 0.1;
694              
695             =item C<$MESSAGE_SIZE_OVERHEAD>
696              
697             34 - size of protocol overhead (data added by protocol) for each message.
698              
699             =back
700              
701             =cut
702             # Look at the structure of 'Message sets'
703             # https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol#AGuideToTheKafkaProtocol-Messagesets
704             # for example the case with an empty key:
705             # Message format:
706             # v0
707             # Message => Crc MagicByte Attributes Key Value
708             # Crc => int32
709             # MagicByte => int8
710             # Attributes => int8
711             # Key => bytes
712             # Value => bytes
713             #
714             # MessageSet => [Offset MessageSize Message]
715             # 00:00:00:00:00:00:00:00: # Offset => int64
716             # 00:00:00:14: # MessageSize => int32 (a size 0x14 = 20 bytes)
717             # Message => Crc MagicByte Attributes Key Value
718             # 8d:c7:95:a2: # Crc => int32
719             # 00: # MagicByte => int8
720             # 00: # Attributes => int8 (the lowest 2 bits - Compression None)
721             # ff:ff:ff:ff: # Key => bytes (a length -1 = null bytes)
722             # 00:00:00:06: # Value => bytes (a length 0x6 = 6 bytes)
723             #
724             # v1 (supported since 0.10.0)
725             # Message => Crc MagicByte Attributes Key Value
726             # Crc => int32
727             # MagicByte => int8
728             # Attributes => int8
729             # Timestamp => int64 # new since 0.10.0
730             # Key => bytes
731             # Value => bytes
732             const our $MESSAGE_SIZE_OVERHEAD => 34;
733              
734             =pod
735              
736             =head2 IP version
737              
738             Specify IP protocol version for resolving of IP address and host names.
739              
740             =over
741              
742             =item C<$IP_V4>
743              
744             Interpret address as IPv4 and force resolving of host name in IPv4.
745              
746             =cut
747             const our $IP_V4 => 4;
748              
749             =item C<$IP_V6>
750              
751             Interpret address as IPv6 and force resolving of host name in IPv6.
752              
753             =back
754              
755             =cut
756             const our $IP_V6 => 6;
757              
758             #-- Codec numbers:
759              
760             =pod
761              
762             =head2 Compression
763              
764             According to Apache Kafka documentation:
765              
766             Kafka currently supports two compression codecs with the following codec numbers:
767              
768             =over
769              
770             =item C<$COMPRESSION_NONE>
771              
772             None = 0
773              
774             =cut
775             const our $COMPRESSION_NONE => 0;
776              
777             =item C<$COMPRESSION_GZIP>
778              
779             GZIP = 1
780              
781             =cut
782             const our $COMPRESSION_GZIP => 1;
783              
784             =item C<$COMPRESSION_SNAPPY>
785              
786             Snappy = 2
787              
788             =cut
789             const our $COMPRESSION_SNAPPY => 2;
790              
791             =back
792              
793             =head2 Error codes
794              
795             Possible error codes (corresponds to descriptions in C<%ERROR>):
796              
797             =over
798              
799             =item C<$ERROR_MISMATCH_ARGUMENT>
800              
801             -1000 - Invalid argument
802              
803             =cut
804             const our $ERROR_MISMATCH_ARGUMENT => -1000;
805              
806             =item C<$ERROR_CANNOT_SEND>
807              
808             -1001 - Cannot send
809              
810             =cut
811             const our $ERROR_CANNOT_SEND => -1001;
812              
813             =item C<$ERROR_SEND_NO_ACK>
814              
815             -1002 - No acknowledgement for sent request
816              
817             =cut
818             const our $ERROR_SEND_NO_ACK => -1002;
819              
820             =item C
821              
822             -1003 - Cannot receive
823              
824             =cut
825             const our $ERROR_CANNOT_RECV => -1003;
826              
827             =item C
828              
829             -1004 - Cannot connect to broker
830              
831             =cut
832             const our $ERROR_CANNOT_BIND => -1004;
833              
834             =item C<$ERROR_METADATA_ATTRIBUTES>
835              
836             -1005 - Unknown metadata attributes
837              
838             =cut
839             const our $ERROR_METADATA_ATTRIBUTES => -1005;
840              
841             =item C<$ERROR_UNKNOWN_APIKEY>
842              
843             -1006 - Unknown ApiKey
844              
845             =cut
846             const our $ERROR_UNKNOWN_APIKEY => -1006;
847              
848             =item C<$ERROR_CANNOT_GET_METADATA>
849              
850             -1007 - Cannot get Metadata
851              
852             =cut
853             const our $ERROR_CANNOT_GET_METADATA => -1007;
854              
855             =item C<$ERROR_LEADER_NOT_FOUND>
856              
857             -1008 - Leader not found
858              
859             =cut
860             const our $ERROR_LEADER_NOT_FOUND => -1008;
861              
862             =item C<$ERROR_MISMATCH_CORRELATIONID>
863              
864             -1009 - Mismatch CorrelationId
865              
866             =cut
867             const our $ERROR_MISMATCH_CORRELATIONID => -1009;
868              
869             =item C<$ERROR_NO_KNOWN_BROKERS>
870              
871             -1010 - There are no known brokers
872              
873             =cut
874             const our $ERROR_NO_KNOWN_BROKERS => -1010;
875              
876             =item C<$ERROR_REQUEST_OR_RESPONSE>
877              
878             -1011 - Bad request or response element
879              
880             =cut
881             const our $ERROR_REQUEST_OR_RESPONSE => -1011;
882              
883             =item C<$ERROR_TOPIC_DOES_NOT_MATCH>
884              
885             -1012 - Topic does not match the requested
886              
887             =cut
888             const our $ERROR_TOPIC_DOES_NOT_MATCH => -1012;
889              
890             =item C<$ERROR_PARTITION_DOES_NOT_MATCH>
891              
892             -1013 - Partition does not match the requested
893              
894             =cut
895             const our $ERROR_PARTITION_DOES_NOT_MATCH => -1013;
896              
897             =item C<$ERROR_NOT_BINARY_STRING>
898              
899             -1014 - Not binary string
900              
901             =cut
902             const our $ERROR_NOT_BINARY_STRING => -1014;
903              
904             =item C<$ERROR_COMPRESSION>
905              
906             -1015 - Compression error
907              
908             =cut
909             const our $ERROR_COMPRESSION => -1015;
910              
911             =item C<$ERROR_RESPONSEMESSAGE_NOT_RECEIVED>
912              
913             -1016 - 'ResponseMessage' not received
914              
915             =cut
916             const our $ERROR_RESPONSEMESSAGE_NOT_RECEIVED => -1016;
917              
918             =item C<$ERROR_INCOMPATIBLE_HOST_IP_VERSION>
919              
920             -1017 - Incompatible host name and IP version
921              
922             =cut
923             const our $ERROR_INCOMPATIBLE_HOST_IP_VERSION => -1017;
924              
925              
926             =item C<$ERROR_NO_CONNECTION>
927              
928             -1018 - No IO connection
929              
930             =cut
931             const our $ERROR_NO_CONNECTION => -1018;
932              
933             =item C<$ERROR_GROUP_COORDINATOR_NOT_FOUND>
934              
935             -1019 - Group Coordinator not found
936              
937             =cut
938             const our $ERROR_GROUP_COORDINATOR_NOT_FOUND => -1019;
939              
940             =back
941              
942             Contains the descriptions of possible error codes obtained via ERROR_CODE box
943             of Apache Kafka Wire Format protocol response.
944              
945             =over
946              
947             =cut
948              
949             #-- The Protocol Error Codes
950              
951             # According
952             # https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol#AGuideToTheKafkaProtocol-ErrorCodes
953              
954             =item C<$ERROR_NO_ERROR>
955              
956             0 - C
957              
958             No error - it worked!
959              
960             =cut
961             const our $ERROR_NO_ERROR => 0;
962              
963             =item C<$ERROR_UNKNOWN>
964              
965             -1 - An unexpected server error.
966              
967             =cut
968             const our $ERROR_UNKNOWN => -1;
969              
970             =item C<$ERROR_OFFSET_OUT_OF_RANGE>
971              
972             1 - The requested offset is not within the range of offsets maintained by the server.
973              
974             =cut
975             const our $ERROR_OFFSET_OUT_OF_RANGE => 1;
976              
977             =item C<$ERROR_INVALID_MESSAGE>
978              
979             2 - This message has failed its CRC checksum, exceeds the valid size, or is otherwise corrupt.
980              
981             Synonym name $ERROR_CORRUPT_MESSAGE .
982              
983             =cut
984             const our $ERROR_INVALID_MESSAGE => 2;
985             const our $ERROR_CORRUPT_MESSAGE => 2;
986              
987             =item C<$ERROR_UNKNOWN_TOPIC_OR_PARTITION>
988              
989             3 - This server does not host this topic-partition.
990              
991             =cut
992             const our $ERROR_UNKNOWN_TOPIC_OR_PARTITION => 3;
993              
994             =item C<$ERROR_INVALID_FETCH_SIZE>
995              
996             4 - The requested fetch size is invalid.
997              
998             Synonym name $ERROR_INVALID_MESSAGE_SIZE .
999              
1000             =cut
1001             const our $ERROR_INVALID_MESSAGE_SIZE => 4;
1002             const our $ERROR_INVALID_FETCH_SIZE => 4;
1003              
1004             =item C<$ERROR_LEADER_NOT_AVAILABLE>
1005              
1006             5 - Unable to write due to ongoing Kafka leader selection.
1007              
1008             This error is thrown if we are in the middle of a leadership election and there is
1009             no current leader for this partition, hence it is unavailable for writes.
1010              
1011             =cut
1012             const our $ERROR_LEADER_NOT_AVAILABLE => 5;
1013              
1014             =item C<$ERROR_NOT_LEADER_FOR_PARTITION>
1015              
1016             6 - Server is not a leader for partition.
1017              
1018             This error is thrown if the client attempts to send messages to a replica that is not the leader for some partition.
1019             It indicates that the clients metadata is out of date.
1020              
1021             =cut
1022             const our $ERROR_NOT_LEADER_FOR_PARTITION => 6;
1023              
1024             =item C<$ERROR_REQUEST_TIMED_OUT>
1025              
1026             7 - Request time-out.
1027              
1028             This error is thrown if the request exceeds the user-specified time limit in the request.
1029              
1030             =cut
1031             const our $ERROR_REQUEST_TIMED_OUT => 7;
1032              
1033             =item C<$ERROR_BROKER_NOT_AVAILABLE>
1034              
1035             8 - Broker is not available.
1036              
1037             This is not a client facing error and is used mostly by tools when a broker is not alive.
1038              
1039             =cut
1040             const our $ERROR_BROKER_NOT_AVAILABLE => 8;
1041              
1042             =item C<$ERROR_REPLICA_NOT_AVAILABLE>
1043              
1044             9 - The replica is not available for the requested topic-partition.
1045              
1046             If replica is expected on a broker, but is not (this can be safely ignored).
1047              
1048             =cut
1049             const our $ERROR_REPLICA_NOT_AVAILABLE => 9;
1050              
1051             =item C<$ERROR_MESSAGE_TOO_LARGE>
1052              
1053             10 - The request included a message larger than the max message size the server will accept.
1054              
1055             The server has a configurable maximum message size to avoid unbounded memory allocation.
1056             This error is thrown if the client attempt to produce a message larger than this maximum.
1057              
1058             Synonym name $ERROR_MESSAGE_SIZE_TOO_LARGE .
1059              
1060             =cut
1061             const our $ERROR_MESSAGE_SIZE_TOO_LARGE => 10;
1062             const our $ERROR_MESSAGE_TOO_LARGE => 10;
1063              
1064             =item C<$ERROR_STALE_CONTROLLER_EPOCH>
1065              
1066             11 - The controller moved to another broker.
1067              
1068             According to Apache Kafka documentation:
1069             Internal error code for broker-to-broker communication.
1070              
1071             Synonym name $ERROR_STALE_CONTROLLER_EPOCH_CODE .
1072              
1073             =cut
1074             const our $ERROR_STALE_CONTROLLER_EPOCH_CODE => 11;
1075             const our $ERROR_STALE_CONTROLLER_EPOCH => 11;
1076              
1077             =item C<$ERROR_OFFSET_METADATA_TOO_LARGE>
1078              
1079             12 - Specified metadata offset is too big
1080              
1081             If you specify a value larger than configured maximum for offset metadata.
1082              
1083             Synonym name $ERROR_OFFSET_METADATA_TOO_LARGE_CODE .
1084              
1085             =cut
1086             const our $ERROR_OFFSET_METADATA_TOO_LARGE => 12;
1087             const our $ERROR_OFFSET_METADATA_TOO_LARGE_CODE => 12;
1088              
1089             =item C<$ERROR_NETWORK_EXCEPTION>
1090              
1091             13 - The server disconnected before a response was received.
1092              
1093             =cut
1094             const our $ERROR_NETWORK_EXCEPTION => 13;
1095              
1096             =item C<$ERROR_GROUP_LOAD_IN_PROGRESS>
1097              
1098             14 - The coordinator is loading and hence can't process requests for this group.
1099              
1100             Synonym name $ERROR_GROUP_LOAD_IN_PROGRESS_CODE, $ERROR_LOAD_IN_PROGRESS_CODE .
1101              
1102             =cut
1103             const our $ERROR_LOAD_IN_PROGRESS_CODE => 14;
1104             const our $ERROR_GROUP_LOAD_IN_PROGRESS => 14;
1105             const our $ERROR_GROUP_LOAD_IN_PROGRESS_CODE => 14;
1106              
1107             =item C<$ERROR_GROUP_COORDINATOR_NOT_AVAILABLE>
1108              
1109             15 - The group coordinator is not available.
1110              
1111             Synonym name $ERROR_GROUP_COORDINATOR_NOT_AVAILABLE_CODE, $ERROR_CONSUMER_COORDINATOR_NOT_AVAILABLE_CODE .
1112              
1113             =cut
1114             const our $ERROR_CONSUMER_COORDINATOR_NOT_AVAILABLE_CODE => 15;
1115             const our $ERROR_GROUP_COORDINATOR_NOT_AVAILABLE => 15;
1116             const our $ERROR_GROUP_COORDINATOR_NOT_AVAILABLE_CODE => 15;
1117              
1118             =item C<$ERROR_NOT_COORDINATOR_FOR_GROUP>
1119              
1120             16 - This is not the correct coordinator for this group.
1121              
1122             Synonym name $ERROR_NOT_COORDINATOR_FOR_GROUP_CODE, $ERROR_NOT_COORDINATOR_FOR_CONSUMER_CODE .
1123              
1124             =cut
1125             const our $ERROR_NOT_COORDINATOR_FOR_CONSUMER_CODE => 16;
1126             const our $ERROR_NOT_COORDINATOR_FOR_GROUP => 16;
1127             const our $ERROR_NOT_COORDINATOR_FOR_GROUP_CODE => 16;
1128              
1129             =item C<$ERROR_INVALID_TOPIC_EXCEPTION>
1130              
1131             17 - The request attempted to perform an operation on an invalid topic.
1132              
1133             Synonym name $ERROR_INVALID_TOPIC_CODE .
1134              
1135             =cut
1136             const our $ERROR_INVALID_TOPIC_CODE => 17;
1137             const our $ERROR_INVALID_TOPIC_EXCEPTION => 17;
1138              
1139             =item C<$ERROR_RECORD_LIST_TOO_LARGE>
1140              
1141             18 - The request included message batch larger than the configured segment size on the server.
1142              
1143             Synonym name $ERROR_RECORD_LIST_TOO_LARGE_CODE .
1144              
1145             =cut
1146             const our $ERROR_RECORD_LIST_TOO_LARGE => 18;
1147             const our $ERROR_RECORD_LIST_TOO_LARGE_CODE => 18;
1148              
1149             =item C<$ERROR_NOT_ENOUGH_REPLICAS>
1150              
1151             19 - Messages are rejected since there are fewer in-sync replicas than required.
1152              
1153             Synonym name $ERROR_NOT_ENOUGH_REPLICAS_CODE .
1154              
1155             =cut
1156             const our $ERROR_NOT_ENOUGH_REPLICAS => 19;
1157             const our $ERROR_NOT_ENOUGH_REPLICAS_CODE => 19;
1158              
1159             =item C<$ERROR_NOT_ENOUGH_REPLICAS_AFTER_APPEND>
1160              
1161             20 - Messages are written to the log, but to fewer in-sync replicas than required.
1162              
1163             Synonym name $ERROR_NOT_ENOUGH_REPLICAS_AFTER_APPEND_CODE .
1164              
1165             =cut
1166             const our $ERROR_NOT_ENOUGH_REPLICAS_AFTER_APPEND => 20;
1167             const our $ERROR_NOT_ENOUGH_REPLICAS_AFTER_APPEND_CODE => 20;
1168              
1169             =item C<$ERROR_INVALID_REQUIRED_ACKS>
1170              
1171             21 - Produce request specified an invalid value for required acks.
1172              
1173             Synonym name $ERROR_INVALID_REQUIRED_ACKS_CODE .
1174              
1175             =cut
1176             const our $ERROR_INVALID_REQUIRED_ACKS => 21;
1177             const our $ERROR_INVALID_REQUIRED_ACKS_CODE => 21;
1178              
1179             =item C<$ERROR_ILLEGAL_GENERATION>
1180              
1181             22 - Specified group generation id is not valid.
1182              
1183             Synonym name $ERROR_ILLEGAL_GENERATION_CODE .
1184              
1185             =cut
1186             const our $ERROR_ILLEGAL_GENERATION => 22;
1187             const our $ERROR_ILLEGAL_GENERATION_CODE => 22;
1188              
1189             =item C<$ERROR_INCONSISTENT_GROUP_PROTOCOL>
1190              
1191             23 - The group member's supported protocols are incompatible with those of existing members.
1192              
1193             Synonym name $ERROR_INCONSISTENT_GROUP_PROTOCOL_CODE .
1194              
1195             =cut
1196             const our $ERROR_INCONSISTENT_GROUP_PROTOCOL => 23;
1197             const our $ERROR_INCONSISTENT_GROUP_PROTOCOL_CODE => 23;
1198              
1199             =item C<$ERROR_INVALID_GROUP_ID>
1200              
1201             24 - The configured groupId is invalid.
1202              
1203             Synonym name $ERROR_INVALID_GROUP_ID_CODE .
1204              
1205             =cut
1206             const our $ERROR_INVALID_GROUP_ID => 24;
1207             const our $ERROR_INVALID_GROUP_ID_CODE => 24;
1208              
1209             =item C<$ERROR_UNKNOWN_MEMBER_ID>
1210              
1211             25 - The coordinator is not aware of this member.
1212              
1213             Synonym name $ERROR_UNKNOWN_MEMBER_ID_CODE .
1214              
1215             =cut
1216             const our $ERROR_UNKNOWN_MEMBER_ID => 25;
1217             const our $ERROR_UNKNOWN_MEMBER_ID_CODE => 25;
1218              
1219             =item C<$ERROR_INVALID_SESSION_TIMEOUT>
1220              
1221             26 - The session timeout is not within the range allowed by the broker
1222             (as configured by group.min.session.timeout.ms and group.max.session.timeout.ms).
1223              
1224             Synonym name $ERROR_INVALID_SESSION_TIMEOUT_CODE .
1225              
1226             =cut
1227             const our $ERROR_INVALID_SESSION_TIMEOUT => 26;
1228             const our $ERROR_INVALID_SESSION_TIMEOUT_CODE => 26;
1229              
1230             =item C<$ERROR_REBALANCE_IN_PROGRESS>
1231              
1232             27 - The group is rebalancing, so a rejoin is needed.
1233              
1234             Synonym name $ERROR_REBALANCE_IN_PROGRESS_CODE .
1235              
1236             =cut
1237             const our $ERROR_REBALANCE_IN_PROGRESS => 27;
1238             const our $ERROR_REBALANCE_IN_PROGRESS_CODE => 27;
1239              
1240             =item C<$ERROR_INVALID_COMMIT_OFFSET_SIZE>
1241              
1242             28 - The committing offset data size is not valid.
1243              
1244             Synonym name $ERROR_INVALID_COMMIT_OFFSET_SIZE_CODE .
1245              
1246             =cut
1247             const our $ERROR_INVALID_COMMIT_OFFSET_SIZE => 28;
1248             const our $ERROR_INVALID_COMMIT_OFFSET_SIZE_CODE => 28;
1249              
1250             =item C<$ERROR_TOPIC_AUTHORIZATION_FAILED>
1251              
1252             29 - Not authorized to access topics: [Topic authorization failed.].
1253              
1254             Synonym name $ERROR_TOPIC_AUTHORIZATION_FAILED_CODE .
1255              
1256             =cut
1257             const our $ERROR_TOPIC_AUTHORIZATION_FAILED => 29;
1258             const our $ERROR_TOPIC_AUTHORIZATION_FAILED_CODE => 29;
1259              
1260             =item C<$ERROR_GROUP_AUTHORIZATION_FAILED>
1261              
1262             30 - Not authorized to access group: Group authorization failed.
1263              
1264             Synonym name $ERROR_GROUP_AUTHORIZATION_FAILED_CODE .
1265              
1266             =cut
1267             const our $ERROR_GROUP_AUTHORIZATION_FAILED => 30;
1268             const our $ERROR_GROUP_AUTHORIZATION_FAILED_CODE => 30;
1269              
1270             =item C<$ERROR_CLUSTER_AUTHORIZATION_FAILED>
1271              
1272             31 - Cluster authorization failed.
1273              
1274             Synonym name $ERROR_CLUSTER_AUTHORIZATION_FAILED_CODE .
1275              
1276             =cut
1277             const our $ERROR_CLUSTER_AUTHORIZATION_FAILED => 31;
1278             const our $ERROR_CLUSTER_AUTHORIZATION_FAILED_CODE => 31;
1279              
1280             =item C<$ERROR_INVALID_TIMESTAMP>
1281              
1282             32 - The timestamp of the message is out of acceptable range.
1283              
1284             =cut
1285             const our $ERROR_INVALID_TIMESTAMP => 32;
1286              
1287             =item C<$ERROR_UNSUPPORTED_SASL_MECHANISM>
1288              
1289             33 - The broker does not support the requested SASL mechanism.
1290              
1291             =cut
1292             const our $ERROR_UNSUPPORTED_SASL_MECHANISM => 33;
1293              
1294             =item C<$ERROR_ILLEGAL_SASL_STATE>
1295              
1296             34 - Request is not valid given the current SASL state.
1297              
1298             =cut
1299             const our $ERROR_ILLEGAL_SASL_STATE => 34;
1300              
1301             =item C<$ERROR_UNSUPPORTED_VERSION>
1302              
1303             35 - The version of API is not supported.
1304              
1305             =cut
1306             const our $ERROR_UNSUPPORTED_VERSION => 35;
1307              
1308             =item C<%ERROR>
1309              
1310             Contains the descriptions for possible error codes.
1311              
1312             =back
1313              
1314             =cut
1315             our %ERROR = (
1316             # Errors fixed by Kafka package
1317             $ERROR_MISMATCH_ARGUMENT => q{Invalid argument},
1318             $ERROR_CANNOT_SEND => q{Cannot send},
1319             $ERROR_SEND_NO_ACK => q{No acknowledgement for sent request},
1320             $ERROR_CANNOT_RECV => q{Cannot receive},
1321             $ERROR_CANNOT_BIND => q{Cannot connect to broker},
1322             $ERROR_METADATA_ATTRIBUTES => q{Unknown metadata attributes},
1323             $ERROR_UNKNOWN_APIKEY => q{Unknown ApiKey},
1324             $ERROR_CANNOT_GET_METADATA => q{Cannot get metadata},
1325             $ERROR_LEADER_NOT_FOUND => q{Leader not found},
1326             $ERROR_MISMATCH_CORRELATIONID => q{Mismatch CorrelationId},
1327             $ERROR_NO_KNOWN_BROKERS => q{There are no known brokers},
1328             $ERROR_REQUEST_OR_RESPONSE => q{Bad request or response element},
1329             $ERROR_TOPIC_DOES_NOT_MATCH => q{Topic does not match the requested},
1330             $ERROR_PARTITION_DOES_NOT_MATCH => q{Partition does not match the requested},
1331             $ERROR_NOT_BINARY_STRING => q{Not binary string},
1332             $ERROR_COMPRESSION => q{Compression error},
1333             $ERROR_RESPONSEMESSAGE_NOT_RECEIVED => q{'ResponseMessage' not received},
1334             $ERROR_INCOMPATIBLE_HOST_IP_VERSION => q{'Incompatible host name and IP version'},
1335             $ERROR_NO_CONNECTION => q{'No connection'},
1336             $ERROR_GROUP_COORDINATOR_NOT_FOUND => q{'Group Coordinator Not Found'},
1337              
1338             #-- The Protocol Error Messages
1339             # https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol#AGuideToTheKafkaProtocol-ErrorCodes
1340             $ERROR_NO_ERROR => q{}, # 'No error--it worked!',
1341             $ERROR_UNKNOWN => q{An unexpected server error},
1342             $ERROR_OFFSET_OUT_OF_RANGE => q{The requested offset is outside the range of offsets maintained by the server for the given topic/partition},
1343             $ERROR_INVALID_MESSAGE => q{Message contents does not match its CRC},
1344             $ERROR_UNKNOWN_TOPIC_OR_PARTITION => q{Unknown topic or partition},
1345             $ERROR_INVALID_FETCH_SIZE => q{The requested fetch size is invalid},
1346             $ERROR_LEADER_NOT_AVAILABLE => q{Unable to write due to ongoing Kafka leader selection},
1347             $ERROR_NOT_LEADER_FOR_PARTITION => q{Server is not a leader for partition},
1348             $ERROR_REQUEST_TIMED_OUT => q{Request time-out},
1349             $ERROR_BROKER_NOT_AVAILABLE => q{Broker is not available},
1350             $ERROR_REPLICA_NOT_AVAILABLE => q{Replica not available},
1351             $ERROR_MESSAGE_TOO_LARGE => q{Message is too big},
1352             $ERROR_STALE_CONTROLLER_EPOCH => q{Stale Controller Epoch Code},
1353             $ERROR_OFFSET_METADATA_TOO_LARGE => q{The metadata field of the offset request was too large},
1354             $ERROR_NETWORK_EXCEPTION => q{The server disconnected before a response was received},
1355             $ERROR_GROUP_LOAD_IN_PROGRESS => q{The coordinator is loading and hence can't process requests for this group},
1356             $ERROR_GROUP_COORDINATOR_NOT_AVAILABLE => q{The group coordinator is not available.},
1357             $ERROR_NOT_COORDINATOR_FOR_GROUP => q{Request for a group that it is not a coordinator for},
1358              
1359             $ERROR_INVALID_TOPIC_EXCEPTION => q{A request which attempts to access an invalid topic},
1360             $ERROR_RECORD_LIST_TOO_LARGE => q{A message batch in a produce request exceeds the maximum configured segment size},
1361             $ERROR_NOT_ENOUGH_REPLICAS => q{Messages are rejected since there are fewer in-sync replicas than required},
1362             $ERROR_NOT_ENOUGH_REPLICAS_AFTER_APPEND => q{Messages are written to the log, but to fewer in-sync replicas than required},
1363             $ERROR_INVALID_REQUIRED_ACKS => q{Produce request specified an invalid value for required acks},
1364             $ERROR_ILLEGAL_GENERATION => q{Specified group generation id is not valid},
1365             $ERROR_INCONSISTENT_GROUP_PROTOCOL => q{The group member's supported protocols are incompatible with those of existing members},
1366             $ERROR_INVALID_GROUP_ID => q{The configured groupId is invalid},
1367             $ERROR_UNKNOWN_MEMBER_ID => q{The coordinator is not aware of this member},
1368             $ERROR_INVALID_SESSION_TIMEOUT => q{The session timeout is not within the range allowed by the broker},
1369             $ERROR_REBALANCE_IN_PROGRESS => q{The group is rebalancing, so a rejoin is needed},
1370             $ERROR_INVALID_COMMIT_OFFSET_SIZE => q{The committing offset data size is not valid},
1371             $ERROR_TOPIC_AUTHORIZATION_FAILED => q{Not authorized to access topics},
1372             $ERROR_GROUP_AUTHORIZATION_FAILED => q{Not authorized to access group: Group authorization failed},
1373             $ERROR_CLUSTER_AUTHORIZATION_FAILED => q{Cluster authorization failed},
1374             $ERROR_INVALID_TIMESTAMP => q{The timestamp of the message is out of acceptable range},
1375             $ERROR_UNSUPPORTED_SASL_MECHANISM => q{The broker does not support the requested SASL mechanism},
1376             $ERROR_ILLEGAL_SASL_STATE => q{Request is not valid given the current SASL state},
1377             $ERROR_UNSUPPORTED_VERSION => q{The version of API is not supported},
1378             );
1379              
1380             =over
1381              
1382             =item C
1383              
1384             Know you are working on 64 or 32 bit system
1385              
1386             =back
1387              
1388             =cut
1389             const our $BITS64 => ( defined( $Config{use64bitint} ) and $Config{use64bitint} eq 'define' ) || $Config{longsize} >= 8;
1390              
1391             #-- public functions -----------------------------------------------------------
1392              
1393             #-- private functions ----------------------------------------------------------
1394              
1395             1;
1396              
1397             __END__