From 24def09ea4d19b076f2bdd6459a05cb829ba255a Mon Sep 17 00:00:00 2001 From: ASUS <515617283@qq.com> Date: Wed, 5 Nov 2025 17:00:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=90=AF=E5=8D=8F=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/process/RabbConsumApplySmsTemp.php | 49 ------------------- .../plugin/webman/gateway-worker/process.php | 1 + config/process.php | 5 +- 3 files changed, 3 insertions(+), 52 deletions(-) delete mode 100644 app/process/RabbConsumApplySmsTemp.php diff --git a/app/process/RabbConsumApplySmsTemp.php b/app/process/RabbConsumApplySmsTemp.php deleted file mode 100644 index 6a7fc39..0000000 --- a/app/process/RabbConsumApplySmsTemp.php +++ /dev/null @@ -1,49 +0,0 @@ -eventLoop = \Workerman\Events\Fiber::class; - $worker->onWorkerStart = function () { - $host = config('cons.mq.host'); - $port = config('cons.mq.port'); - $user = config('cons.mq.user'); - $password = config('cons.mq.password'); - $queue = config('cons.mq.queue_t') . '-apply.sms.temp'; - $client = Client::factory([ - 'host' => $host, - 'port' => $port, - 'user' => $user, - 'password' => $password, - 'vhost' => '/', - 'heartbeat' => 30, - 'heartbeat_callback' => function () { - echo " [-] coroutine-consumer-heartbeat\n"; - }, - 'interval' => [100, 300] - ])->connect(); - $channel = $client->channel(); - $channel->queueDeclare($queue); - $channel->consume(function (Message $message, Channel $channel, \Bunny\AbstractClient $client) { - echo " [>] 接收到消息 ", $message->content, "\n"; - }, - $queue, - '', - false, - true - ); - $client->run(); - echo ' [*] Waiting for messages. To exit press CTRL+C', "\n"; - }; - } -} \ No newline at end of file diff --git a/config/plugin/webman/gateway-worker/process.php b/config/plugin/webman/gateway-worker/process.php index 9a3475d..c9e5e44 100644 --- a/config/plugin/webman/gateway-worker/process.php +++ b/config/plugin/webman/gateway-worker/process.php @@ -22,6 +22,7 @@ return [ 'worker' => [ 'handler' => BusinessWorker::class, 'count' => cpu_count()*2, + 'eventLoop' => \Workerman\Events\Swoole::class, 'constructor' => ['config' => [ 'eventHandler' => plugin\webman\gateway\Events::class, 'name' => 'ChatBusinessWorker', diff --git a/config/process.php b/config/process.php index 88d4101..b78cc89 100644 --- a/config/process.php +++ b/config/process.php @@ -13,7 +13,6 @@ */ use app\process\MessagePushTask; -use app\process\RabbConsumApplySmsTemp; use support\Log; use support\Request; use app\process\Http; @@ -28,8 +27,8 @@ return [ 'user' => '', 'group' => '', 'reusePort' => false, - 'eventLoop' => '', -// 'eventLoop' => \Workerman\Events\Swoole::class, +// 'eventLoop' => '', + 'eventLoop' => \Workerman\Events\Swoole::class, 'context' => [], 'constructor' => [ 'requestClass' => Request::class,