改名
This commit is contained in:
+5
-5
@@ -81,19 +81,19 @@ class Kafka extends \Snowflake\Process\Process
|
|||||||
$objRdKafka = new \RdKafka\Consumer($config);
|
$objRdKafka = new \RdKafka\Consumer($config);
|
||||||
$topic = $objRdKafka->newTopic($kafkaServer['topic'], $topic);
|
$topic = $objRdKafka->newTopic($kafkaServer['topic'], $topic);
|
||||||
$topic->consumeStart(0, RD_KAFKA_OFFSET_STORED);
|
$topic->consumeStart(0, RD_KAFKA_OFFSET_STORED);
|
||||||
Timer::tick($conf['interval'] ?? 1000, function () use ($topic) {
|
while (true) {
|
||||||
$this->resolve($topic);
|
$this->resolve($topic, $conf['interval'] ?? 1000);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ConsumerTopic $topic
|
* @param ConsumerTopic $topic
|
||||||
*/
|
*/
|
||||||
private function resolve(ConsumerTopic $topic)
|
private function resolve(ConsumerTopic $topic, $intval)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$message = $topic->consume(0, 10);
|
$message = $topic->consume(0, $intval);
|
||||||
if (empty($message)) {
|
if (empty($message)) {
|
||||||
$this->application->debug('message null.');
|
$this->application->debug('message null.');
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user