swooletw / laravel-swoole

High performance HTTP server based on Swoole. Speed up your Laravel or Lumen applications.
MIT License
4.04k stars 389 forks source link

关于task和协程 #73

Closed junshenshi closed 6 years ago

junshenshi commented 6 years ago

Please answer these questions before submitting your issue. Thanks!

  1. Please provide your PHP and Swoole version. (php -v and php --ri swoole) php 7.2 swoole2.1.3

  2. Please provide your Laravel/Lumen version. laravel5.5

  3. Which release version of this package are you using? 2.2.1

如何实现TASK,协程异步IO? 看了src,只看到task push的方法,请问下以后会加入task自定义操作嘛?

albertcht commented 6 years ago

Hi @junshenshi ,

Coroutine features are still under develop in branch feature/coroutine_feature. It will provide mysql, http coroutine clients and DB connection pool. This feature requires Swoole 4.0 and will be released after Swoole 4.0 stable version comes out.

Async task feature is not supported yet. It will be considered to be supported in the future. I suggest using coroutine clients for asyc I/O(after feature/coroutine_feature is released) and using laravel queue for other async task jobs.

junshenshi commented 6 years ago

嗨!@albertcht OK 刚刚查看了feature/coroutine_feature分支,建议可支持多种协程, 另外希望会有个example目录展示所有功能,以便参考使用。

albertcht commented 6 years ago

Hi @junshenshi ,

In the coroutine feature, users will be able to use all the coroutine clients naturally based on Swoole 4.0. I just provide a more advanced integration with Eloquent for more elegant usage with MySQL client.