From 9353a5fe944ca3c65d2c7a7cc908ee7f2b193d82 Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Sun, 11 Apr 2021 19:15:24 +0800 Subject: [PATCH] modify --- Kafka/Kafka.php | 7 +++++++ System/Snowflake.php | 1 + 2 files changed, 8 insertions(+) diff --git a/Kafka/Kafka.php b/Kafka/Kafka.php index d9d095c3..447aff9a 100644 --- a/Kafka/Kafka.php +++ b/Kafka/Kafka.php @@ -13,6 +13,7 @@ use RdKafka\TopicConf; use Snowflake\Core\Json; use Snowflake\Snowflake; use Swoole\Coroutine\Channel; +use Swoole\Coroutine\System; use Swoole\Process; use Throwable; @@ -34,6 +35,12 @@ class Kafka extends \Snowflake\Process\Process */ public function onHandler(Process $process): void { + $content = System::readFile(storage('runtime.php')); + + $annotation = Snowflake::app()->getAnnotation(); + $annotation->setLoader(unserialize($content)); + $annotation->runtime(KAFKA_PATH); + $this->waite(swoole_unserialize($process->read())); } diff --git a/System/Snowflake.php b/System/Snowflake.php index 9c4bba84..b890e99b 100644 --- a/System/Snowflake.php +++ b/System/Snowflake.php @@ -24,6 +24,7 @@ defined('DB_ERROR_BUSY') or define('DB_ERROR_BUSY', 'The database is busy. Pleas defined('SELECT_IS_NULL') or define('SELECT_IS_NULL', 'Query data does not exist, please check the relevant conditions.'); defined('PARAMS_IS_NULL') or define('PARAMS_IS_NULL', 'Required items cannot be empty, please add.'); defined('CONTROLLER_PATH') or define('CONTROLLER_PATH', APP_PATH . 'app/Http/Controllers/'); +defined('KAFKA_PATH') or define('KAFKA_PATH', APP_PATH . 'app/Kafka/'); defined('RPC_SERVICE_PATH') or define('RPC_SERVICE_PATH', APP_PATH . 'app/Http/Rpc/'); defined('RPC_CLIENT_PATH') or define('RPC_CLIENT_PATH', APP_PATH . 'app/Client/Rpc/'); defined('MODEL_PATH') or define('MODEL_PATH', APP_PATH . 'app/Models/');