Sergey Gladkov > Kafka > Kafka::Internals



Annotate this POD


New  1
Open  0
View/Report Bugs
Module Version: 1.001001   Source  


Kafka::Internals - Constants and functions used internally.


This documentation refers to Kafka::Internals version 1.001001 .


    use 5.010;
    use strict;
    use warnings;

    use Kafka::Internals qw(

    my $bin_stream_size = $MAX_SOCKET_REQUEST_BYTES;


This module is private and should not be used directly.

In order to achieve better performance, functions of this module do not perform arguments validation.


The following constants are available for export


The numeric code that the ApiKey in the request take for the ProduceRequest request type.


The numeric code that the ApiKey in the request take for the FetchRequest request type.


The numeric code that the ApiKey in the request take for the OffsetRequest request type.


The numeric code that the ApiKey in the request take for the MetadataRequest request type.


The maximum number of bytes in a socket request.

The maximum size of a request that the socket server will accept. Default limit (as configured in is 104857600.


According to Apache Kafka documentation: 'When the producer is sending messages it doesn't actually know the offset and can fill in any value here it likes.'


Largest positive integer on 32-bit machines.


Largest positive integer on 32-bit machines.


Largest positive int16 value.


The following methods are defined in the Kafka::Internals:

debug_level( $flags )

Gets or sets debug level for a particular Kafka module, based on environment variable PERL_KAFKA_DEBUG or flags.

$flags - (string) argument that can be used to pass coma delimited module names (omit Kafka::).

Returns $DEBUG level for the module from which debug_level was called.


    say format_reference( $object );

Dumps reference using preconfigured Data::Dumper. Produces less verbose output than default Data::Dumper settings.


    $string = format_message( 'Object %d loaded. Status: %s', $id, $message );

Returns string formatted using printf-style syntax.

If there are more than one argument and the first argument contains %... conversions, arguments are converted to a string message using sprintf(). In this case, undefined values are printed as <undef> and references are converted to strings using "format_reference".


The basic operation of the Kafka package modules:

Kafka - constants and messages used by the Kafka package modules.

Kafka::Connection - interface to connect to a Kafka cluster.

Kafka::Producer - interface for producing client.

Kafka::Consumer - interface for consuming client.

Kafka::Message - interface to access Kafka message properties.

Kafka::Int64 - functions to work with 64 bit elements of the protocol on 32 bit systems.

Kafka::Protocol - functions to process messages in the Apache Kafka's Protocol.

Kafka::IO - low-level interface for communication with Kafka server.

Kafka::Exceptions - module designated to handle Kafka exceptions.

Kafka::Internals - internal constants and functions used by several package modules.

A wealth of detail about the Apache Kafka and the Kafka Protocol:

Main page at

Kafka Protocol at


Kafka package is hosted on GitHub:


Sergey Gladkov, <>


Alexander Solovey

Jeremy Jordan

Sergiy Zuban

Vlad Marchenko


Copyright (C) 2012-2016 by TrackingSoft LLC.

This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic at

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

syntax highlighting: