PHP Class Kafka\SimpleProduce

Author: $_SWANBR_AUTHOR_$ +------------------------------------------------------------------------------
Datei anzeigen Open project: nmred/kafka-php

Public Methods

Method Description
__construct ( $hostList, null $timeout = null, null $kafkaHostList = null ) __construct
getAvailablePartitions ( ) : array get available partition
getClient ( ) : Client get client object
getInstance ( $hostList, $timeout, null $kafkaHostList = null ) : kafka\Produce set send messages
send ( $messages ) : boolean | array send message to broker
setRequireAck ( integer $ack ) : kafka\Produce set request mode This field indicates how many acknowledgements the servers should receive before responding to the request. If it is 0 the server will not send any response (this is the only case where the server will not reply to a request). If it is 1, the server will wait the data is written to the local log before sending a response. If it is -1 the server will block until the message is committed by all in sync replicas before sending a response. For any number > 1 the server will block waiting for this number of acknowledgements to occur (but the server will never wait for more acknowledgements than there are in-sync replicas).
setStreamOptions ( array $options = [] ) passthru method to client for setting stream options
setTimeOut ( integer $timeout = 100 ) : kafka\Produce set request timeout
setTopic ( $topicName, integer $partitionId ) : kafka\Produce set topic

Private Methods

Method Description
_formatPayload ( $messages ) : array format payload array

Method Details

__construct() public method

__construct
public __construct ( $hostList, null $timeout = null, null $kafkaHostList = null )
$hostList
$timeout null
$kafkaHostList null

getAvailablePartitions() public method

get available partition
public getAvailablePartitions ( ) : array
return array

getClient() public method

get client object
public getClient ( ) : Client
return Client

getInstance() public static method

set send messages
public static getInstance ( $hostList, $timeout, null $kafkaHostList = null ) : kafka\Produce
$hostList
$timeout
$kafkaHostList null
return kafka\Produce

send() public method

send message to broker
public send ( $messages ) : boolean | array
return boolean | array $messages

setRequireAck() public method

set request mode This field indicates how many acknowledgements the servers should receive before responding to the request. If it is 0 the server will not send any response (this is the only case where the server will not reply to a request). If it is 1, the server will wait the data is written to the local log before sending a response. If it is -1 the server will block until the message is committed by all in sync replicas before sending a response. For any number > 1 the server will block waiting for this number of acknowledgements to occur (but the server will never wait for more acknowledgements than there are in-sync replicas).
public setRequireAck ( integer $ack ) : kafka\Produce
$ack integer
return kafka\Produce

setStreamOptions() public method

passthru method to client for setting stream options
public setStreamOptions ( array $options = [] )
$options array

setTimeOut() public method

set request timeout
public setTimeOut ( integer $timeout = 100 ) : kafka\Produce
$timeout integer
return kafka\Produce

setTopic() public method

set topic
public setTopic ( $topicName, integer $partitionId ) : kafka\Produce
$topicName
$partitionId integer
return kafka\Produce