This commit is contained in:
as2252258@163.com
2021-04-11 19:02:42 +08:00
parent 42ce1015c2
commit 858e4b2ba5
4 changed files with 28 additions and 1 deletions
+8 -1
View File
@@ -104,7 +104,14 @@ class Kafka extends \Snowflake\Process\Process
$setting = $server->setting['worker_num'];
$message = swoole_serialize(['action' => 'kafka', 'body' => [$topic, $message]]);
/** @var TaskContainer $container */
$container = Snowflake::app()->get('kafka-container');
$handler = $container->getConsumer($topic);
if (empty($handler)) {
return;
}
$message = swoole_serialize(['action' => 'kafka', 'handler' => $handler, 'body' => [$topic, $message]]);
$server->sendMessage($message, random_int(0, $setting - 1));
} catch (Throwable $exception) {