Merge branch 'master' into pr/1575

This commit is contained in:
李铭昕 2020-04-20 10:14:55 +08:00
commit f5033e9cc8
1593 changed files with 636 additions and 1674 deletions

View File

@ -81,6 +81,7 @@ return PhpCsFixer\Config::create()
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('bin')
->exclude('public')
->exclude('runtime')
->exclude('vendor')

View File

@ -1,8 +1,27 @@
# v1.1.26 - TBD
# v1.1.27 - TBD
## Added
- [#1586](https://github.com/hyperf/hyperf/pull/1586) Added conflict of symfony/event-dispatcher which < 4.3.
# v1.1.26 - 2020-04-16
## Added
- [#1578](https://github.com/hyperf/hyperf/pull/1578) Support `getStream` method in `UploadedFile.php`.
## Fixed
- [#1563](https://github.com/hyperf/hyperf/pull/1563) Fixed crontab's `onOneServer` option not resetting mutex on shutdown
- [#1563](https://github.com/hyperf/hyperf/pull/1563) Fixed crontab's `onOneServer` option not resetting mutex on shutdown.
- [#1565](https://github.com/hyperf/hyperf/pull/1565) Reset transaction level to zero, when reconnent to mysql server.
- [#1572](https://github.com/hyperf/hyperf/pull/1572) Fixed parent class does not exists in `Hyperf\GrpcServer\CoreMiddleware`.
- [#1577](https://github.com/hyperf/hyperf/pull/1577) Fixed `describe:routes` command's `server` option not take effect.
- [#1579](https://github.com/hyperf/hyperf/pull/1579) Fixed `migrate:refresh` command's `step` is int.
## Changed
- [#1560](https://github.com/hyperf/hyperf/pull/1560) Changed functions of file to `filesystem` for `FileSystemDriver` in `hyperf/cache`.
- [#1568](https://github.com/hyperf/hyperf/pull/1568) Changed `\Redis` to `RedisProxy` for `RedisDriver` in `async-queue`.
# v1.1.25 - 2020-04-09

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
! defined('BASE_PATH') && define('BASE_PATH', __DIR__);
! defined('SWOOLE_HOOK_FLAGS') && define('SWOOLE_HOOK_FLAGS', SWOOLE_HOOK_ALL);

View File

@ -74,6 +74,7 @@
"swoole/ide-helper": "dev-master",
"sy-records/think-template": "^2.0",
"symfony/console": "^4.2",
"symfony/event-dispatcher": "^4.3",
"symfony/finder": "^4.1",
"symfony/property-access": "^4.3",
"symfony/serializer": "^4.3",
@ -136,6 +137,9 @@
"hyperf/websocket-server": "self.version"
},
"suggest": {},
"conflict": {
"symfony/event-dispatcher": "<4.3"
},
"autoload": {
"files": [
"src/config/src/Functions.php",

View File

@ -18,6 +18,7 @@ composer require hyperf/async-queue
|:----------------:|:---------:|:-------------------------------------------:|:---------------------------------------:|
| driver | string | Hyperf\AsyncQueue\Driver\RedisDriver::class | 无 |
| channel | string | queue | 队列前缀 |
| redis.pool | string | default | redis连接池 |
| timeout | int | 2 | pop 消息的超时时间 |
| retry_seconds | int,array | 5 | 失败后重新尝试间隔 |
| handle_timeout | int | 10 | 消息处理超时时间 |
@ -31,6 +32,9 @@ composer require hyperf/async-queue
return [
'default' => [
'driver' => Hyperf\AsyncQueue\Driver\RedisDriver::class,
'redis' => [
'pool' => 'default'
],
'channel' => 'queue',
'timeout' => 2,
'retry_seconds' => 5,

View File

@ -1,5 +1,24 @@
# 版本更新记录
# v1.1.26 - 2020-04-16
## Added
- [#1578](https://github.com/hyperf/hyperf/pull/1578) `UploadedFile` 支持 `getStream` 方法。
## Fixed
- [#1563](https://github.com/hyperf/hyperf/pull/1563) 修复服务关停后,定时器的 `onOneServer` 配置不会被重置。
- [#1565](https://github.com/hyperf/hyperf/pull/1565) 当 `DB` 组件重连 `Mysql` 时,重置事务等级为 0。
- [#1572](https://github.com/hyperf/hyperf/pull/1572) 修复 `Hyperf\GrpcServer\CoreMiddleware`自定义类的父类找不到时报错的BUG。
- [#1577](https://github.com/hyperf/hyperf/pull/1577) 修复 `describe:routes` 脚本 `server` 配置不生效的BUG。
- [#1579](https://github.com/hyperf/hyperf/pull/1579) 修复 `migrate:refresh` 脚本 `step` 参数不为 `int` 时会报错的BUG。
## Changed
- [#1560](https://github.com/hyperf/hyperf/pull/1560) 修改 `hyperf/cache` 组件文件缓存引擎中 原生的文件操作为 `Filesystem`
- [#1568](https://github.com/hyperf/hyperf/pull/1568) 修改 `hyperf/async-queue` 组件 `Redis` 引擎中的 `\Redis``RedisProxy`
# v1.1.25 - 2020-04-09
## Fixed

View File

@ -39,14 +39,23 @@ declare(strict_types=1);
namespace App\Controller;
class IndexController
class IndexController extends AbstractController
{
public function example(\League\Flysystem\Filesystem $filesystem)
{
// Process Upload
$file = $this->request->file('upload');
$stream = fopen($file->getRealPath(), 'r+');
$filesystem->writeStream(
'uploads/'.$file->getClientFilename(),
$stream
);
fclose($stream);
// Write Files
$filesystem->write('path/to/file.txt', 'contents');
// Write Use writeStream
// Add local file
$stream = fopen('local/path/to/file.txt', 'r+');
$result = $filesystem->writeStream('path/to/file.txt', $stream);
if (is_resource($stream)) {
@ -122,7 +131,8 @@ return [
1. S3 存储请确认安装 `hyperf/guzzle` 组件以提供协程化支持。阿里云、七牛云存储请[开启 Curl Hook](/zh-cn/coroutine?id=swoole-runtime-hook-level)来使用协程。因 Curl Hook 的参数支持性问题,请使用 Swoole 4.4.13 以上版本。
2. minIO, ceph radosgw 等私有对象存储方案均支持 S3 协议,可以使用 S3 适配器。
3. 以阿里云 OSS 为例1 核 1 进程读操作性能对比:
3. 使用Local驱动时根目录是配置好的地址而不是操作系统的根目录。例如Local驱动 `root` 设置为 `/var/www`, 则本地磁盘上的 `/var/www/public/file.txt` 通过 flysystem API 访问时应使用 `/public/file.txt``public/file.txt`
4. 以阿里云 OSS 为例1 核 1 进程读操作性能对比:
```bash
ab -k -c 10 -n 1000 http://127.0.0.1:9501/

View File

@ -62,30 +62,6 @@ vendor/bin/init-proxy.sh && composer test
vendor/bin/init-proxy.sh && php bin/hyperf.php start
```
## PHP7.3 下预先生成代理的脚本 执行失败
`php bin/hyperf.php di:init-proxy` 脚本在 `PHP7.3``Docker` 打包时,会因为返回码是 `1` 而失败。
> 具体原因还在定位中
以下通过重写 `init-proxy.sh` 脚本绕过这个问题。
```bash
#!/usr/bin/env bash
php /opt/www/bin/hyperf.php di:init-proxy
echo Started.
```
对应的 `Dockerfile` 修改以下代码,省略无用的代码展示。
```dockerfile
RUN composer install --no-dev \
&& composer dump-autoload -o \
&& ./init-proxy.sh
```
## 异步队列消息丢失
如果在使用 `async-queue` 组件时,发现 `handle` 中的方法没有执行,请先检查以下几种情况:
@ -97,3 +73,27 @@ RUN composer install --no-dev \
1. killall php
2. 修改 `async-queue` 配置 `channel`
## 1.1.24 - 1.1.26 版本 SymfonyEventDispatcher 报错
因为 `symfony/console` 默认使用的 `^4.2` 版本,而 `symfony/event-dispatcher``^4.3` 版本与 `<4.3` 版本不兼容。
`hyperf/framework` 默认推荐使用 `^4.3` 版本的 `symfony/event-dispatcher`,就有一定概率导致实现上的冲突。
如果有类似的情况出现,可以尝试以下操作
```
rm -rf vendor
rm -rf composer.lock
composer require "symfony/event-dispatcher:^4.3"
```
1.1.27 版本中,会在 `composer.json` 中添加以下配置,来处理这个问题。
```
"conflict": {
"symfony/event-dispatcher": "<4.3"
},
```

View File

@ -18,6 +18,7 @@ composer require hyperf/async-queue
|:----------------:|:---------:|:-------------------------------------------:|:---------------------------------------:|
| driver | string | Hyperf\AsyncQueue\Driver\RedisDriver::class | 無 |
| channel | string | queue | 隊列前綴 |
| redis.pool | string | default | redis連接池 |
| timeout | int | 2 | pop 消息的超時時間 |
| retry_seconds | int,array | 5 | 失敗後重新嘗試間隔 |
| handle_timeout | int | 10 | 消息處理超時時間 |
@ -31,6 +32,9 @@ composer require hyperf/async-queue
return [
'default' => [
'driver' => Hyperf\AsyncQueue\Driver\RedisDriver::class,
'redis' => [
'pool' => 'default'
],
'channel' => 'queue',
'timeout' => 2,
'retry_seconds' => 5,

View File

@ -1,5 +1,24 @@
# 版本更新記錄
# v1.1.26 - 2020-04-16
## Added
- [#1578](https://github.com/hyperf/hyperf/pull/1578) `UploadedFile` 支持 `getStream` 方法。
## Fixed
- [#1563](https://github.com/hyperf/hyperf/pull/1563) 修復服務關停後,定時器的 `onOneServer` 配置不會被重置。
- [#1565](https://github.com/hyperf/hyperf/pull/1565) 當 `DB` 組件重連 `Mysql` 時,重置事務等級為 0。
- [#1572](https://github.com/hyperf/hyperf/pull/1572) 修復 `Hyperf\GrpcServer\CoreMiddleware`自定義類的父類找不到時報錯的BUG。
- [#1577](https://github.com/hyperf/hyperf/pull/1577) 修復 `describe:routes` 腳本 `server` 配置不生效的BUG。
- [#1579](https://github.com/hyperf/hyperf/pull/1579) 修復 `migrate:refresh` 腳本 `step` 參數不為 `int` 時會報錯的BUG。
## Changed
- [#1560](https://github.com/hyperf/hyperf/pull/1560) 修改 `hyperf/cache` 組件文件緩存引擎中 原生的文件操作為 `Filesystem`
- [#1568](https://github.com/hyperf/hyperf/pull/1568) 修改 `hyperf/async-queue` 組件 `Redis` 引擎中的 `\Redis``RedisProxy`
# v1.1.25 - 2020-04-09
## Fixed

View File

@ -101,6 +101,23 @@ class IndexController
}
```
### 配置靜態資源
如果您希望通過 http 訪問上傳到本地的文件,請在 `config/autoload/server.php` 配置中增加以下配置。
```
return [
'settings' => [
...
// 將 public 替換為上傳目錄
'document_root' => BASE_PATH . '/public',
'static_handler_locations' => ['/'],
'enable_static_handler' => true,
],
];
```
## 注意事項
1. S3 存儲請確認安裝 `hyperf/guzzle` 組件以提供協程化支持。阿里雲、七牛雲存儲請[開啟 Curl Hook](/zh-cn/coroutine?id=swoole-runtime-hook-level)來使用協程。因 Curl Hook 的參數支持性問題,請使用 Swoole 4.4.13 以上版本。
@ -217,4 +234,4 @@ return [
],
],
];
```
```

View File

@ -23,3 +23,25 @@ Hyperf 提供了大量便捷的輔助類,這裏會列出一些常用的好用
### Hyperf\Utils\Context
用於處理協程上下文,本質上是對 `Swoole\Coroutine::getContext()` 方法的一個封裝,但區別在於這裏兼容了非協程環境下的運行。
### Hyperf\Utils\Coordinator\CoordinatorManager
該輔助類用於指揮協程等待事件發生。
```php
<?php
use Hyperf\Utils\Coordinator\CoordinatorManager;
use Hyperf\Utils\Coordinator\Constants;
use Hyperf\Utils\Coroutine;
Coroutine::create(function() {
// 所有OnWorkerStart事件回調完成後喚醒
CoordinatorManager::until(Constants::WORKER_START)->yield();
echo 'worker started';
// 分配資源
// 所有OnWorkerExit事件回調完成後喚醒
CoordinatorManager::until(Constants::WORKER_EXIT)->yield();
echo 'worker exited';
// 回收資源
});
```

View File

@ -18,6 +18,7 @@ composer require hyperf/async-queue
|:----------------:|:---------:|:-------------------------------------------:|:---------------------------------------:|
| driver | string | Hyperf\AsyncQueue\Driver\RedisDriver::class | 無 |
| channel | string | queue | 佇列字首 |
| redis.pool | string | default | redis連線池 |
| timeout | int | 2 | pop 訊息的超時時間 |
| retry_seconds | int,array | 5 | 失敗後重新嘗試間隔 |
| handle_timeout | int | 10 | 訊息處理超時時間 |
@ -31,6 +32,9 @@ composer require hyperf/async-queue
return [
'default' => [
'driver' => Hyperf\AsyncQueue\Driver\RedisDriver::class,
'redis' => [
'pool' => 'default'
],
'channel' => 'queue',
'timeout' => 2,
'retry_seconds' => 5,

View File

@ -1,5 +1,24 @@
# 版本更新記錄
# v1.1.26 - 2020-04-16
## Added
- [#1578](https://github.com/hyperf/hyperf/pull/1578) `UploadedFile` 支援 `getStream` 方法。
## Fixed
- [#1563](https://github.com/hyperf/hyperf/pull/1563) 修復服務關停後,定時器的 `onOneServer` 配置不會被重置。
- [#1565](https://github.com/hyperf/hyperf/pull/1565) 當 `DB` 元件重連 `Mysql` 時,重置事務等級為 0。
- [#1572](https://github.com/hyperf/hyperf/pull/1572) 修復 `Hyperf\GrpcServer\CoreMiddleware`自定義類的父類找不到時報錯的BUG。
- [#1577](https://github.com/hyperf/hyperf/pull/1577) 修復 `describe:routes` 指令碼 `server` 配置不生效的BUG。
- [#1579](https://github.com/hyperf/hyperf/pull/1579) 修復 `migrate:refresh` 指令碼 `step` 引數不為 `int` 時會報錯的BUG。
## Changed
- [#1560](https://github.com/hyperf/hyperf/pull/1560) 修改 `hyperf/cache` 元件檔案快取引擎中 原生的檔案操作為 `Filesystem`
- [#1568](https://github.com/hyperf/hyperf/pull/1568) 修改 `hyperf/async-queue` 元件 `Redis` 引擎中的 `\Redis``RedisProxy`
# v1.1.25 - 2020-04-09
## Fixed

View File

@ -101,6 +101,23 @@ class IndexController
}
```
### 配置靜態資源
如果您希望通過 http 訪問上傳到本地的檔案,請在 `config/autoload/server.php` 配置中增加以下配置。
```
return [
'settings' => [
...
// 將 public 替換為上傳目錄
'document_root' => BASE_PATH . '/public',
'static_handler_locations' => ['/'],
'enable_static_handler' => true,
],
];
```
## 注意事項
1. S3 儲存請確認安裝 `hyperf/guzzle` 元件以提供協程化支援。阿里雲、七牛雲端儲存請[開啟 Curl Hook](/zh-cn/coroutine?id=swoole-runtime-hook-level)來使用協程。因 Curl Hook 的引數支援性問題,請使用 Swoole 4.4.13 以上版本。
@ -217,4 +234,4 @@ return [
],
],
];
```
```

View File

@ -23,3 +23,25 @@ Hyperf 提供了大量便捷的輔助類,這裡會列出一些常用的好用
### Hyperf\Utils\Context
用於處理協程上下文,本質上是對 `Swoole\Coroutine::getContext()` 方法的一個封裝,但區別在於這裡相容了非協程環境下的執行。
### Hyperf\Utils\Coordinator\CoordinatorManager
該輔助類用於指揮協程等待事件發生。
```php
<?php
use Hyperf\Utils\Coordinator\CoordinatorManager;
use Hyperf\Utils\Coordinator\Constants;
use Hyperf\Utils\Coroutine;
Coroutine::create(function() {
// 所有OnWorkerStart事件回撥完成後喚醒
CoordinatorManager::until(Constants::WORKER_START)->yield();
echo 'worker started';
// 分配資源
// 所有OnWorkerExit事件回撥完成後喚醒
CoordinatorManager::until(Constants::WORKER_EXIT)->yield();
echo 'worker exited';
// 回收資源
});
```

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
'default' => [
'host' => env('AMQP_HOST', 'localhost'),

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Annotation;
use Hyperf\Di\Annotation\AbstractAnnotation;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Annotation;
use Hyperf\Di\Annotation\AbstractAnnotation;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp;
use Hyperf\Amqp\Message\MessageInterface;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Builder;
use PhpAmqpLib\Wire\AMQPTable;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Builder;
class ExchangeBuilder extends Builder

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Builder;
class QueueBuilder extends Builder

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp;
use Hyperf\Amqp\Listener\BeforeMainServerStartListener;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp;
use Hyperf\Amqp\Connection\AMQPSwooleConnection;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Connection;
use PhpAmqpLib\Connection\AbstractConnection;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Connection;
use InvalidArgumentException;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Connection;
use Hyperf\Contract\StdoutLoggerInterface;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Connection;
use InvalidArgumentException;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp;
class Constants

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp;
use Hyperf\Amqp\Event\AfterConsume;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp;
use Hyperf\Amqp\Pool\PoolFactory;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp;
use Hyperf\Amqp\Annotation\Consumer as ConsumerAnnotation;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp;
use Hyperf\Contract\ConnectionInterface;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Event;
use Hyperf\Amqp\Message\ConsumerMessageInterface;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Event;
class BeforeConsume extends ConsumeEvent

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Event;
use Hyperf\Amqp\Message\ConsumerMessageInterface;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Event;
use Hyperf\Amqp\Message\ConsumerMessageInterface;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Exception;
use Exception;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Listener;
use Hyperf\Amqp\ConsumerManager;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Listener;
use Doctrine\Instantiator\Instantiator;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Message;
use Hyperf\Amqp\Builder\QueueBuilder;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Message;
use Hyperf\Amqp\Builder\QueueBuilder;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Message;
use Hyperf\Amqp\Builder\ExchangeBuilder;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Message;
use Hyperf\Amqp\Builder\ExchangeBuilder;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Message;
use Hyperf\Amqp\Constants;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Message;
interface ProducerMessageInterface extends MessageInterface

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Message;
class Type

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Packer;
use Hyperf\Contract\PackerInterface;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp;
class Params

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Pool;
use Hyperf\Amqp\Connection;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Pool;
use Hyperf\Pool\Frequency as DefaultFrequency;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp\Pool;
use Hyperf\Di\Container;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp;
use Hyperf\Amqp\Message\ProducerMessageInterface;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Amqp;
class Result

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace HyperfTest\Amqp;
use Hyperf\Amqp\Annotation\Consumer;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace HyperfTest\Amqp;
use Hyperf\Amqp\Connection\KeepaliveIO;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace HyperfTest\Amqp\Message;
use Hyperf\Amqp\Consumer;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace HyperfTest\Amqp\Message;
use HyperfTest\Amqp\Stub\DemoConsumer;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace HyperfTest\Amqp;
use Hyperf\Amqp\Params;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace HyperfTest\Amqp\Stub;
use Hyperf\Amqp\Consumer;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace HyperfTest\Amqp\Stub;
use Hyperf\Amqp\Message\ConsumerMessage;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace HyperfTest\Amqp\Stub;
use Hyperf\Amqp\Message\ProducerMessage;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace HyperfTest\Amqp\Stub;
use Hyperf\Amqp\Message\ConsumerMessage;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace HyperfTest\Amqp\Stub;
use Hyperf\Amqp\Connection\Socket;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace HyperfTest\Amqp\Stub;
use Hyperf\Amqp\Connection\Socket;

View File

@ -9,10 +9,12 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
'default' => [
'driver' => \Hyperf\AsyncQueue\Driver\RedisDriver::class,
'redis' => [
'pool' => 'default',
],
'channel' => 'queue',
'timeout' => 2,
'retry_seconds' => 5,

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue\Annotation;
use Hyperf\Di\Annotation\AbstractAnnotation;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue;
use Hyperf\Contract\CompressInterface;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue\Aspect;
use Hyperf\AsyncQueue\Annotation\AsyncQueueMessage;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue\Command;
use Hyperf\AsyncQueue\Driver\DriverFactory;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue\Command;
use Hyperf\AsyncQueue\Driver\DriverFactory;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue\Command;
use Hyperf\AsyncQueue\Driver\DriverFactory;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue;
class ConfigProvider

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue\Driver;
use Hyperf\AsyncQueue\Exception\InvalidQueueException;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue\Driver;
use Hyperf\AsyncQueue\Environment;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue\Driver;
use Hyperf\AsyncQueue\Exception\InvalidDriverException;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue\Driver;
use Hyperf\AsyncQueue\JobInterface;

View File

@ -9,15 +9,14 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue\Driver;
use Hyperf\AsyncQueue\Exception\InvalidQueueException;
use Hyperf\AsyncQueue\JobInterface;
use Hyperf\AsyncQueue\Message;
use Hyperf\AsyncQueue\MessageInterface;
use Hyperf\Redis\RedisFactory;
use Psr\Container\ContainerInterface;
use Redis;
class RedisDriver extends Driver
{
@ -53,8 +52,7 @@ class RedisDriver extends Driver
{
parent::__construct($container, $config);
$channel = $config['channel'] ?? 'queue';
$this->redis = $container->get(Redis::class);
$this->redis = $container->get(RedisFactory::class)->get($config['redis']['pool'] ?? 'default');
$this->timeout = $config['timeout'] ?? 5;
$this->retrySeconds = $config['retry_seconds'] ?? 10;
$this->handleTimeout = $config['handle_timeout'] ?? 10;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue;
class Environment

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue\Event;
class AfterHandle extends Event

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue\Event;
class BeforeHandle extends Event

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue\Event;
use Hyperf\AsyncQueue\MessageInterface;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue\Event;
use Hyperf\AsyncQueue\MessageInterface;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue\Event;
use Hyperf\AsyncQueue\Driver\DriverInterface;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue\Event;
use Hyperf\AsyncQueue\MessageInterface;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue\Exception;
class InvalidDriverException extends \RuntimeException

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue\Exception;
class InvalidPackerException extends \RuntimeException

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue\Exception;
class InvalidQueueException extends \RuntimeException

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue;
use Hyperf\Contract\CompressInterface;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue;
interface JobInterface

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue\Listener;
use Hyperf\AsyncQueue\Event\QueueLength;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue;
use Hyperf\Contract\CompressInterface;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue;
interface MessageInterface

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\AsyncQueue\Process;
use Hyperf\AsyncQueue\Driver\DriverFactory;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace HyperfTest\AsyncQueue;
use Hyperf\AsyncQueue\Annotation\AsyncQueueMessage;

View File

@ -9,11 +9,11 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace HyperfTest\AsyncQueue;
use Hyperf\AsyncQueue\Driver\ChannelConfig;
use Hyperf\Di\Container;
use Hyperf\Redis\RedisFactory;
use Hyperf\Utils\ApplicationContext;
use Hyperf\Utils\Coroutine\Concurrent;
use Hyperf\Utils\Packer\PhpSerializerPacker;
@ -60,6 +60,11 @@ class DriverTest extends TestCase
$container->shouldReceive('make')->with(ChannelConfig::class, Mockery::any())->andReturnUsing(function ($class, $args) {
return new ChannelConfig($args['channel']);
});
$container->shouldReceive('get')->with(RedisFactory::class)->andReturnUsing(function ($_) {
$factory = Mockery::mock(RedisFactory::class);
$factory->shouldReceive('get')->with('default')->andReturn(new Redis());
return $factory;
});
ApplicationContext::setContainer($container);

View File

@ -9,13 +9,13 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace HyperfTest\AsyncQueue;
use Hyperf\AsyncQueue\Driver\ChannelConfig;
use Hyperf\AsyncQueue\Driver\RedisDriver;
use Hyperf\AsyncQueue\Message;
use Hyperf\Di\Container;
use Hyperf\Redis\RedisFactory;
use Hyperf\Utils\ApplicationContext;
use Hyperf\Utils\Context;
use Hyperf\Utils\Packer\PhpSerializerPacker;
@ -118,13 +118,18 @@ class RedisDriverTest extends TestCase
$container = Mockery::mock(Container::class);
$container->shouldReceive('get')->with(PhpSerializerPacker::class)->andReturn($packer);
$container->shouldReceive('get')->once()->with(EventDispatcherInterface::class)->andReturn(null);
$container->shouldReceive('get')->once()->with(\Redis::class)->andReturn(new Redis());
$container->shouldReceive('get')->with(\Redis::class)->andReturn(new Redis());
$container->shouldReceive('make')->with(ChannelConfig::class, Mockery::any())->andReturnUsing(function ($class, $args) {
return new ChannelConfig($args['channel']);
});
$container->shouldReceive('make')->with(Message::class, Mockery::any())->andReturnUsing(function ($class, $args) {
return new Message(...$args);
});
$container->shouldReceive('get')->with(RedisFactory::class)->andReturnUsing(function ($_) {
$factory = Mockery::mock(RedisFactory::class);
$factory->shouldReceive('get')->with('default')->andReturn(new Redis());
return $factory;
});
ApplicationContext::setContainer($container);

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace HyperfTest\AsyncQueue\Stub;
use Hyperf\AsyncQueue\Job;

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace HyperfTest\AsyncQueue\Stub;
use Hyperf\Contract\CompressInterface;

Some files were not shown because too many files have changed in this diff Show More