更多请看 https://blog.csdn.net/fenglailea/article/details/80515310
配合 https://github.com/foxiswho/docker-nginx-php-swoole-rabbitmq-consul 使用
https://www.kancloud.cn/manual/thinkphp5_1/353948
composer create-project topthink/think php-thinkphp5-swoole
https://github.com/top-think/think-swoole
composer require topthink/think-swoole
https://www.consul.io/api/libraries-and-sdks.html https://github.com/dcarbone/php-consul-api
composer require dcarbone/php-consul-api
#PHP服务
php public/index.php service/demo/start
#生产者 发出信息
php public/index.php mq/publisher.demo/index
#订阅者 处理消息
php public/index.php mq/subscriber.demo/index
浏览器
http://localhost/demo/service_demo_client/index
或
http://localhost/demo/service_demo_mq_client/index
当前根目录下执行
php public/index.php service/demo/start
在新的终端中执行:
telnet 127.0.0.1 9501
然后在终端中输入 hello
终端打印出
onReceive: hello