Commit 181722c0 by zhufx

扫描rpc连接池配置

parent d990ba99
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/7/12
* Time: 13:48
*/
$base_path = dirname(__DIR__,2);
$scan_path = $base_path.'/Pool/Config';
$paths = scandir($scan_path);
if ( empty($paths) ) {
return [];
}
$base_namespace = "Hdll\Services\Common\Pool\Config";
$bean_config = [];
foreach ( $paths as $path ) {
if ( $path == '.' || $path == '..' ) {
continue;
}
$file = $scan_path.'/'.$path;
$path_info = pathinfo($file);
if ( ! isset($path_info['filename']) ) {
continue;
}
$poolClassName = $base_namespace.'\\'.$path_info['filename'];
if(!class_exists($poolClassName)){
continue;
}
$bean_config[$poolClassName] = ['class' => $poolClassName];
}
return $bean_config;
\ No newline at end of file
<?php
/**
* This file is part of Swoft.
*
* @link https://swoft.org
* @document https://doc.swoft.org
* @contact group@swoft.org
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace Hdll\Services\Common\Pool\Config;
use Swoft\Bean\Annotation\Bean;
use Swoft\Pool\PoolProperties;
/**
* the config of service user
*/
class OrderPoolConfig extends PoolProperties
{
protected $name = 'buyer';
/**
* Minimum active number of connections
*
* @var int
*/
protected $minActive = 5;
/**
* the maximum number of active connections
*
* @var int
*/
protected $maxActive = 50;
/**
* the maximum number of wait connections
*
* @var int
*/
protected $maxWait = 100;
/**
* Maximum waiting time
*
* @var int
*/
protected $maxWaitTime = 3;
/**
* Maximum idle time
*
* @var int
*/
protected $maxIdleTime = 60;
/**
* the time of connect timeout
*
* @var int
*/
protected $timeout = 200;
/**
* the addresses of connection
*
* <pre>
* [
* '127.0.0.1:88',
* '127.0.0.1:88'
* ]
* </pre>
*
* @var array
*/
protected $uri = [
'192.168.3.100:8100',
];
/**
* whether to user provider(consul/etcd/zookeeper)
*
* @var bool
*/
protected $useProvider = false;
/**
* the default balancer is random balancer
*
* @var string
*/
protected $balancer = '';
/**
* the default provider is consul provider
*
* @var string
*/
protected $provider = '';
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment