window 64位系统,php版本5.6.35
1.安装redis, 教程 https://www.cnblogs.com/tommy-huang/p/6093813.html
2.thinkphp5.0, composer require topthink/think-queue 安装好think-queue
3.使用方法:https://github.com/coolseven/notes/blob/master/thinkphp-queue/README.md
4.发布任务,http://192.168.0.146:1001/index.php/index/job_test/actionWithHelloJob
5.处理消息:php think queue:work --queue helloJobQueue
有时不会处理,用监听的方法处理:php think queue:listen --queue helloJobQueue
6.新增 \application\index\job\Hello.php
消费者类,并编写其 fire()
方法,这个是处理消息
7.新增 \application\index\controller\JobTest.php
控制器,这个是发送消息 http://192.168.0.146:1001/index.php/index/job_test/actionWithHelloJob