composer update

This commit is contained in:
zyimm 2023-07-09 17:20:38 +08:00
parent 0fe177e770
commit f662f64cf0
3 changed files with 7 additions and 5 deletions

View File

@ -2,6 +2,7 @@
"name": "tm_xls/rocket-mq-client-thinkphp", "name": "tm_xls/rocket-mq-client-thinkphp",
"description": "rocket-mq-thinkphp 适配客户端", "description": "rocket-mq-thinkphp 适配客户端",
"license": "proprietary", "license": "proprietary",
"type": "tm_xls_rocket_mq",
"authors": [ "authors": [
{ {
"name": "zyimm", "name": "zyimm",

View File

@ -5,4 +5,6 @@ namespace tm\xls\rocketMq\thinkphp\consumer\contract;
interface ListenerInterface interface ListenerInterface
{ {
public function handle(); public function handle();
public function enable();
} }

View File

@ -7,14 +7,13 @@ use function React\Async\coroutine;
$path = config('rocket_mq.callback', '/rocketmq/producer/notify'); $path = config('rocket_mq.callback', '/rocketmq/producer/notify');
//注册回调路由 //注册回调路由
Route::post($path, function () { Route::post($path, function () {
$promise = coroutine(function () { coroutine(function () {
app()->make(Consumer::class, [ app()->make(Consumer::class, [
request()->param() request()->param()
])->distribute(); ])->distribute();
}); })->then(function () {
$promise->then(function () { echo 'success';
return 'success';
},function (){ },function (){
return 'error'; echo 'error';
}); });
}); });