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 0.800_2 .
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.
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 take argument. The following argument is currently recognized:
$bin_stream_ref-
$bin_stream_refis 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 take argument. The following argument is currently recognized:
$Produce_Response-
$Produce_Responseis 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 take argument. The following argument is currently recognized:
$bin_stream_ref-
$bin_stream_refis 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 take argument. The following argument is currently recognized:
$Fetch_Response-
$Fetch_Responseis 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 take argument. The following argument is currently recognized:
$bin_stream_ref-
$bin_stream_refis 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 take argument. The following argument is currently recognized:
$Offset_Response-
$Offset_Responseis 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 take argument. The following argument is currently recognized:
$bin_stream_ref-
$bin_stream_refis 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 take argument. The following argument is currently recognized:
$Metadata_Response-
$Metadata_Responseis 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::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
AUTHOR
Sergey Gladkov, <sgladkov@trackingsoft.com>
CONTRIBUTORS
Alexander Solovey
Jeremy Jordan
Vlad Marchenko
COPYRIGHT AND LICENSE
Copyright (C) 2012-2013 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.