|
NAMEKafka::IO - Interface to network communication with the Apache Kafka server.VERSIONThis documentation refers to "Kafka::IO" version 0.8010 .SYNOPSISuse 5.010; use strict; use warnings; use Scalar::Util qw( blessed ); use Try::Tiny; use Kafka::IO; my $io; try { $io = Kafka::IO->new( host => 'localhost' ); } catch { if ( blessed( $_ ) && $_->isa( 'Kafka::Exception' ) ) { warn 'Error: (', $_->code, ') ', $_->message, "\n"; exit; } else { die $_; } }; # Closes and cleans up $io->close; undef $io; DESCRIPTIONThis module is private and should not be used directly.In order to achieve better performance, methods of this module do not perform arguments validation. The main features of the "Kafka::IO" class are:
CONSTRUCTOR"new"Establishes TCP connection to given host and port, creates and returns "Kafka::IO" IO object. "new()" takes arguments in key-value pairs. The following arguments are currently recognized:
METHODSThe following methods are provided by "Kafka::IO" class:"send( $message )" Sends a $message to Kafka. The argument must be a bytes string. Returns the number of characters sent. "receive( $length )" Receives a message up to $length size from Kafka. $length argument must be a positive number. Returns a reference to the received message. "close" Closes connection to Kafka server. "is_alive" The method verifies whether we are connected to Kafka server. DIAGNOSTICSWhen error is detected, an exception, represented by object of "Kafka::Exception::Producer" class, is thrown (see Kafka::Exceptions).code and a more descriptive message provide information about thrown exception. Consult documentation of the Kafka::Exceptions for the list of all available methods. Authors suggest using of Try::Tiny's "try" and "catch" to handle exceptions while working with Kafka package. Here is the list of possible error messages that "Kafka::IO" may produce:
Debug modeDebug output can be enabled by passing desired level via environment variable using one of the following ways:"PERL_KAFKA_DEBUG=1" - debug is enabled for the whole Kafka package. "PERL_KAFKA_DEBUG=IO:1" - enable debug for "Kafka::IO" only. "Kafka::IO" supports two debug levels (level 2 includes debug output of 1):
SEE ALSOThe 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 CODEKafka package is hosted on GitHub: <https://github.com/TrackingSoft/Kafka>AUTHORSergey Gladkov, <sgladkov@trackingsoft.com>CONTRIBUTORSAlexander SoloveyJeremy Jordan Sergiy Zuban Vlad Marchenko COPYRIGHT AND LICENSECopyright (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.
Visit the GSP FreeBSD Man Page Interface. |