Kafka-php Configuration

September 5, 2019 ยท View on GitHub

PropertyC/PRangeDefaultDesc
brokerVersionC/P0.8.00.10.1.0User supplied broker version
clientIdC/Pkafka-phpThis is a user supplied identifier for the client application
messageMaxBytesC/P1000 .. 10000000001000000Maximum transmit message size.
metadataBrokerListC/PKafka Broker server list
metadataMaxAgeMsC/P1 .. 86400000-1Metadata cache max age. Defaults to metadata.refresh.interval.ms * 3
metadataRefreshIntervalMsC/P10 .. 3600000300000Topic metadata refresh interval in milliseconds. The metadata is automatically refreshed on error and connect. Use -1 to disable the intervalled refresh.
metadataRequestTimeoutMsC/P10 .. 90000060000Non-topic request timeout in milliseconds. This is for metadata requests, etc.
sslEnableC/Ptrue/falsefalseWhether enable ssl connect or not
sslEnableAuthenticationC/Ptrue/falsetrueEnable authentication via SSL
sslCafileC/PLocation of Certificate Authority file on local filesystem which should be used with the verify_peer context option to authenticate the identity of the remote peer.
sslLocalCertC/PFile pathPath to local certificate file on filesystem.
sslLocalPkC/PFile pathPath to local private key file on filesystem in case of separate files for certificate (local_cert) and private key.
sslPassphraseC/PPassphrase with which your local_cert file was encoded.
sslPeerNameC/PPeer name to be used. If this value is not set, then the name is guessed based on the hostname used when opening the stream.
sslVerifyPeerC/Ptrue/falsefalseRequire verification of SSL certificate used.
offsetResetClatest,earliestlatestAction to take when there is no initial offset in offset store or the desired offset is out of range
groupIdCClient group id string. All clients sharing the same group.id belong to the same group.
maxBytesC65536Maximum bytes to fetch.
maxWaitTimeC100Maximum time in ms to wait for the response
sessionTimeoutC1 .. 360000030000Client group session and failure detection timeout.
rebalanceTimeoutC1 .. 360000030000rebalance join wait timeout
topicsCWant consumer topics
isAsynPtrue, falsefalseWhether to use asynchronous production messages
produceIntervalP1 .. 900000100The time interval at which requests for production messages are executed when the message is produced asynchronously
requestTimeoutP1 .. 9000006000The total timeout of the production message, which must be greater than the timeout config parameter
requiredAckP-1 .. 10001This field indicates how many acknowledgements the leader broker must receive from ISR brokers before responding to the request: 0=Broker does not send any response/ack to client, 1=Only the leader broker will need to ack the message, -1 or all=broker will block until message is committed by all in sync replicas (ISRs) or broker's in.sync.replicas setting before sending response.
timeoutP1 .. 9000005000Producer request timeout

Note

All of the above parameters are set by setXxx, for example, to set the clientId parameter

<?php

$config = \Kafka\ConsumerConfig::getInstance();
$config->setClientId('test');

Whether it is a consumer module or a production module, if the parameter settings do not match the rules will throw \Kafka\Exception\Config exception