NAME
Kafka::MockProtocol - functions to simulate the messages formation by the kafka server (in the Apache Kafka's Protocol).
VERSION
This documentation refers to Kafka::MockProtocol
version 1.08 .
DESCRIPTION
This module is not a user module.
The main features of the Kafka::MockProtocol
module are:
Supports parsing the Apache Kafka protocol to emulate the operations performed by the kafka server.
Supports Apache Kafka Requests and Responses (PRODUCE, FETCH, OFFSET, METADATA).
Support for working with 64 bit elements of the Kafka protocol on 32 bit systems.
FUNCTIONS
The following functions are available for Kafka::MockProtocol
module.
encode_saslhandshake_response( $saslhandshake_response )
Encodes the argument and returns a string representing the structure of the SaslHandshake Response.
This function takes the following arguments:
decode_saslhandshake_request( $bin_stream_ref )
Decodes the argument and returns a reference to the hash representing the structure of the SaslHandshake Request (examples see t/*_decode_encode.t
).
This function takes the following arguments:
$bin_stream_ref
-
$bin_stream_ref
is a reference to the encoded Request buffer. The buffer must be a non-empty binary string.
decode_produce_request( $bin_stream_ref )
Decodes the argument and returns a reference to the hash representing the structure of the PRODUCE Request (examples see t/*_decode_encode.t
).
This function takes the following arguments:
$bin_stream_ref
-
$bin_stream_ref
is a reference to the encoded Request buffer. The buffer must be a non-empty binary string.
encode_produce_response( $Produce_Response )
Encodes the argument and returns a reference to the encoded binary string representing a Response buffer.
This function takes the following arguments:
$Produce_Response
-
$Produce_Response
is a reference to the hash representing the structure of the PRODUCE Response (examples seet/*_decode_encode.t
).
decode_fetch_request( $bin_stream_ref )
Decodes the argument and returns a reference to the hash representing the structure of the FETCH Request (examples see t/*_decode_encode.t
).
This function takes the following arguments:
$bin_stream_ref
-
$bin_stream_ref
is a reference to the encoded Request buffer. The buffer must be a non-empty binary string.
encode_fetch_response( $Fetch_Response )
Encodes the argument and returns a reference to the encoded binary string representing a Response buffer.
This function takes the following arguments:
$Fetch_Response
-
$Fetch_Response
is a reference to the hash representing the structure of the FETCH Response (examples seet/*_decode_encode.t
).
decode_offset_request( $bin_stream_ref )
Decodes the argument and returns a reference to the hash representing the structure of the OFFSET Request (examples see t/*_decode_encode.t
).
This function takes the following arguments:
$bin_stream_ref
-
$bin_stream_ref
is a reference to the encoded Request buffer. The buffer must be a non-empty binary string.
encode_offset_response( $Produce_Response )
Encodes the argument and returns a reference to the encoded binary string representing a Response buffer.
This function takes the following arguments:
$Offset_Response
-
$Offset_Response
is a reference to the hash representing the structure of the OFFSET Response (examples seet/*_decode_encode.t
).
decode_metadata_request( $bin_stream_ref )
Decodes the argument and returns a reference to the hash representing the structure of the METADATA Request (examples see t/*_decode_encode.t
).
This function takes the following arguments:
$bin_stream_ref
-
$bin_stream_ref
is a reference to the encoded Request buffer. The buffer must be a non-empty binary string.
encode_metadata_response( $Metadata_Response )
Encodes the argument and returns a reference to the encoded binary string representing a Response buffer.
This function takes the following arguments:
$Metadata_Response
-
$Metadata_Response
is a reference to the hash representing the structure of the METADATA Response (examples seet/*_decode_encode.t
).
Kafka::MockProtocol::last_errorcode()
This method returns an error code that specifies the description in the %Kafka::ERROR
hash. Analysing this information can be done to determine the cause of the error.
Kafka::MockProtocol::last_error()
This method returns an error message that contains information about the encountered failure. Messages returned from this method may contain additional details and do not coincide completely with the %Kafka::ERROR
hash.
DIAGNOSTICS
Error will set the non-zero value returned by "Kafka::MockProtocol::last_errorcode()" function.
Error messages are presented in the hash %Kafka::ERROR. You may experience the following errors:
$Kafka::ERROR_MISMATCH_ARGUMENT
-
This means that you didn't give the right argument to some of functions.
$Kafka::ERROR_REQUEST_OR_RESPONSE
-
This means that one of the fields of the request or response contains invalid data.
$Kafka::ERROR_NOT_BINARY_STRING
-
This means that one of the string fields of response does not contain a string or contains a string with Unicode data.
For more error description, always look at the message from the Kafka::MockProtocol::last_error()
function.
SEE ALSO
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 http://kafka.apache.org/
Kafka Protocol at https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol
SOURCE CODE
Kafka package is hosted on GitHub: https://github.com/TrackingSoft/Kafka
AUTHOR
Sergey Gladkov
CONTRIBUTORS
Alexander Solovey
Jeremy Jordan
Sergiy Zuban
Vlad Marchenko
COPYRIGHT AND LICENSE
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 http://dev.perl.org/licenses/artistic.html.
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.