改名
This commit is contained in:
+3
-5
@@ -38,7 +38,7 @@ class Kafka extends \Snowflake\Process\Process
|
|||||||
$config->setTopics($kafka['topics']);
|
$config->setTopics($kafka['topics']);
|
||||||
|
|
||||||
$this->channel = new Channel(1000);
|
$this->channel = new Channel(1000);
|
||||||
$this->initCoroutine();
|
go([$this, 'listener']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -59,11 +59,10 @@ class Kafka extends \Snowflake\Process\Process
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* 监听通道数据传递
|
||||||
*/
|
*/
|
||||||
public function initCoroutine()
|
protected function listener()
|
||||||
{
|
{
|
||||||
go(function () {
|
|
||||||
$group = new WaitGroup();
|
$group = new WaitGroup();
|
||||||
while ([$topic, $part, $message] = $this->channel->pop()) {
|
while ([$topic, $part, $message] = $this->channel->pop()) {
|
||||||
try {
|
try {
|
||||||
@@ -87,7 +86,6 @@ class Kafka extends \Snowflake\Process\Process
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$group->wait();
|
$group->wait();
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user