This commit is contained in:
as2252258@163.com
2021-08-11 01:04:57 +08:00
parent 63d8eaa4a5
commit 682246df28
219 changed files with 790 additions and 791 deletions
+5 -5
View File
@@ -11,9 +11,9 @@ use RdKafka\Exception;
use RdKafka\KafkaConsumer;
use RdKafka\TopicConf;
use Server\SInterface\CustomProcess;
use Snowflake\Abstracts\Config;
use Snowflake\Exception\ConfigException;
use Snowflake\Snowflake;
use Kiri\Abstracts\Config;
use Kiri\Exception\ConfigException;
use Kiri\Kiri;
use Swoole\Coroutine\Channel;
use Swoole\Process;
use Throwable;
@@ -120,12 +120,12 @@ class Kafka implements CustomProcess
{
go(function () use ($topic, $message) {
try {
$server = Snowflake::app()->getSwoole();
$server = Kiri::app()->getSwoole();
$setting = $server->setting['worker_num'];
/** @var KafkaProvider $container */
$container = Snowflake::getDi()->get(KafkaProvider::class);
$container = Kiri::getDi()->get(KafkaProvider::class);
$data = $container->getConsumer($topic);
if (!empty($data)) {
$server->sendMessage(new $data(new Struct($topic, $message)), random_int(0, $setting - 1));