改名
This commit is contained in:
+3
-9
@@ -166,24 +166,18 @@ class Kafka extends \Snowflake\Process\Process
|
|||||||
private function kafkaConfig($kafka)
|
private function kafkaConfig($kafka)
|
||||||
{
|
{
|
||||||
$conf = new Conf();
|
$conf = new Conf();
|
||||||
$conf->setRebalanceCb(function (KafkaConsumer $kafka, $err, array $partitions = null) {
|
$conf->setRebalanceCb([$this, 'rebalanced_cb']);
|
||||||
if ($err == RD_KAFKA_RESP_ERR__ASSIGN_PARTITIONS) {
|
|
||||||
$kafka->assign($partitions);
|
|
||||||
} else if ($err == RD_KAFKA_RESP_ERR__REVOKE_PARTITIONS) {
|
|
||||||
$kafka->assign(NULL);
|
|
||||||
} else {
|
|
||||||
throw new \Exception($err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$conf->set('group.id', $kafka['groupId']);
|
$conf->set('group.id', $kafka['groupId']);
|
||||||
$conf->set('metadata.broker.list', $kafka['brokers']);
|
$conf->set('metadata.broker.list', $kafka['brokers']);
|
||||||
$conf->set('socket.timeout.ms', 30000);
|
$conf->set('socket.timeout.ms', 30000);
|
||||||
|
|
||||||
if (function_exists('pcntl_sigprocmask')) {
|
if (function_exists('pcntl_sigprocmask')) {
|
||||||
pcntl_sigprocmask(SIG_BLOCK, array(SIGIO));
|
pcntl_sigprocmask(SIG_BLOCK, array(SIGIO));
|
||||||
$conf->set('internal.termination.signal', SIGIO);
|
$conf->set('internal.termination.signal', SIGIO);
|
||||||
} else {
|
} else {
|
||||||
$conf->set('queue.buffering.max.ms', 1);
|
$conf->set('queue.buffering.max.ms', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$topicConf = new TopicConf();
|
$topicConf = new TopicConf();
|
||||||
$topicConf->set('auto.commit.enable', 1);
|
$topicConf->set('auto.commit.enable', 1);
|
||||||
$topicConf->set('auto.commit.interval.ms', 100);
|
$topicConf->set('auto.commit.interval.ms', 100);
|
||||||
|
|||||||
Reference in New Issue
Block a user