改名
This commit is contained in:
+3
-10
@@ -72,7 +72,7 @@ class Kafka extends \Snowflake\Process\Process
|
|||||||
$group->add();
|
$group->add();
|
||||||
go(function () use ($group) {
|
go(function () use ($group) {
|
||||||
while ([$topic, $part, $message] = $this->channel->pop()) {
|
while ([$topic, $part, $message] = $this->channel->pop()) {
|
||||||
$this->handlerExecute($group, $topic, $part, $message);
|
$this->handlerExecute($topic, $part, $message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -82,12 +82,11 @@ class Kafka extends \Snowflake\Process\Process
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $group
|
|
||||||
* @param $topic
|
* @param $topic
|
||||||
* @param $part
|
* @param $part
|
||||||
* @param $message
|
* @param $message
|
||||||
*/
|
*/
|
||||||
protected function handlerExecute($group, $topic, $part, $message)
|
protected function handlerExecute($topic, $part, $message)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$namespace = 'App\\Kafka\\' . ucfirst($topic) . 'Consumer';
|
$namespace = 'App\\Kafka\\' . ucfirst($topic) . 'Consumer';
|
||||||
@@ -98,13 +97,7 @@ class Kafka extends \Snowflake\Process\Process
|
|||||||
if (!($class instanceof ConsumerInterface)) {
|
if (!($class instanceof ConsumerInterface)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$group->add();
|
$class->onHandler(new Struct($topic, $part, $message));
|
||||||
go(function () use ($group, $class, $topic, $part, $message) {
|
|
||||||
defer(function () use ($group) {
|
|
||||||
$group->done();
|
|
||||||
});
|
|
||||||
$class->onHandler(new Struct($topic, $part, $message));
|
|
||||||
});
|
|
||||||
} catch (\Throwable $exception) {
|
} catch (\Throwable $exception) {
|
||||||
$this->application->error($exception->getMessage());
|
$this->application->error($exception->getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user