协程版仓库后端项目
Some checks failed
Build Docker / build (push) Has been cancelled

This commit is contained in:
2025-07-08 14:59:47 +08:00
commit 0b2299c427
134 changed files with 19277 additions and 0 deletions

View File

@ -0,0 +1,63 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
use App\JsonRpc\EasyAppServiceInterface;
use App\JsonRpc\InventoryServiceInterface;
use App\JsonRpc\UserAuthServiceInterface;
use function Hyperf\Support\value;
return [
'consumers' => value(function () {
$consumers = [];
$services = [
'UserAuthService' => UserAuthServiceInterface::class,
'EasyAppService' => EasyAppServiceInterface::class,
'InventoryService' => InventoryServiceInterface::class,
];
foreach ($services as $name => $interface) {
$consumers[] = [
'name' => $name,
'service' => $interface,
'protocol' => 'jsonrpc-http',
'load_balancer' => 'random',
'registry' => [
'protocol' => 'nacos',
'address' => 'http://127.0.0.1:8848',
],
'options' => [
'connect_timeout' => 5.0,
'recv_timeout' => 5.0,
'settings' => [
// 开启连接池
'open_connection_pool' => true,
],
// 重试次数,默认值为 2收包超时不进行重试。暂只支持 JsonRpcPoolTransporter
'retry_count' => 2,
// 重试间隔,毫秒
'retry_interval' => 100,
// 使用多路复用 RPC 时的心跳间隔null 为不触发心跳
'heartbeat' => 30,
'pool' => [
'min_connections' => 1,
'max_connections' => 100,
'connect_timeout' => 10.0,
'wait_timeout' => 3.0,
'heartbeat' => 30,
'max_idle_time' => 60.0,
],
]
];
}
return $consumers;
}),
];