rocket-mq-client-thinkphp/src/route.php

19 lines
467 B
PHP

<?php
use think\facade\Route;
use tm\xls\rocketMq\thinkphp\consumer\Consumer;
use function React\Async\coroutine;
$path = config('rocket_mq.callback', '/rocketmq/producer/notify');
//注册回调路由
Route::any($path.'$', function () {
coroutine(function () {
app()->make(Consumer::class, [
request()->param()
])->distribute();
})->then(function () {
echo 'success';
},function (){
echo 'error';
});
});