|o||Provides an object oriented API for communication with Kafka.|
|o||This class allows you to create Kafka 0.8 clients.|
new() takes arguments in key-value pairs. The following arguments are currently recognized:
host => $host $host is an Apache Kafka host to connect to. It can be a hostname or the IP-address in the xx.xx.xx.xx form. port => $port Optional, default = $KAFKA_SERVER_PORT. timeout => $timeout Optional, default = $REQUEST_TIMEOUT.
$timeout specifies how long we wait for remote server to respond before the IO object disconnects and throws internal exception. The $timeout is specified in seconds (could be any integer or floating-point type) and supported by gethostbyname(), connect, blocking receive and send calls.
$REQUEST_TIMEOUT is the default timeout that can be imported from the Kafka module.
Special behavior when timeout is set to undef:
o Alarms are not used internally (namely when performing gethostbyname). o Default $REQUEST_TIMEOUT is used for the rest of IO operations.
The 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.
Closes connection to Kafka server.
The method verifies whether we are connected to Kafka server.
When 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.
Invalid argument Invalid arguments were passed to a method. Cant send Message cant be sent on a Kafka::IO object socket. Cant recv Message cant be received. Cant bind TCP connection cant be established on given host and port.
Debug 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.
1. Additional information about processing events/alarms. 2. Dump of binary messages exchange with Kafka server.
The basic operation of the Kafka package modules:
Kafka::Int64 - functions to work with 64 bit elements of the protocol on 32 bit systems.
Kafka::Internals - internal constants and functions used by several package modules.
Main page at <http://kafka.apache.org/>
Sergey Gladkov, <firstname.lastname@example.org>
Copyright (C) 2012-2013 by TrackingSoft LLC.
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.
|perl v5.20.3||KAFKA::IO (3)||2015-02-06|