Merge remote-tracking branch 'origin/utils' into utils

This commit is contained in:
Reasno 2020-04-21 14:12:04 +08:00
commit e87f1c3878
1571 changed files with 593 additions and 1634 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,23 @@
# v1.1.26 - TBD
# v1.1.27 - TBD
# 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

@ -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 以上版本。

View File

@ -30,14 +30,17 @@ Hyperf 提供了大量便捷的辅助类,这里会列出一些常用的好用
```php
<?php
use \Hyperf\Utils\Coordinator\CoordinatorManager as CM;
use \Hyperf\Utils\Coordinator\Constants as C;
use Hyperf\Utils\Coordinator\CoordinatorManager;
use Hyperf\Utils\Coordinator\Constants;
use Hyperf\Utils\Coroutine;
go(function(){
CM::until(C::WORKER_START)->yield(); //所有OnWorkerStart事件回调完成后唤醒。
Coroutine::create(function() {
// 所有OnWorkerStart事件回调完成后唤醒
CoordinatorManager::until(Constants::WORKER_START)->yield();
echo 'worker started';
// 分配资源
CM::until(C::WORKER_EXIT)->yield(); //所有OnWorkerExit事件回调完成后唤醒。
// 所有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 以上版本。

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 以上版本。

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;

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