From f662f64cf08caecdc542ad306a796308d1ba0e1f Mon Sep 17 00:00:00 2001 From: zyimm Date: Sun, 9 Jul 2023 17:20:38 +0800 Subject: [PATCH] composer update --- composer.json | 1 + src/consumer/contract/ListenerInterface.php | 2 ++ src/route.php | 9 ++++----- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 19824f1..8b14305 100644 --- a/composer.json +++ b/composer.json @@ -2,6 +2,7 @@ "name": "tm_xls/rocket-mq-client-thinkphp", "description": "rocket-mq-thinkphp 适配客户端", "license": "proprietary", + "type": "tm_xls_rocket_mq", "authors": [ { "name": "zyimm", diff --git a/src/consumer/contract/ListenerInterface.php b/src/consumer/contract/ListenerInterface.php index 581fe5c..98222dd 100644 --- a/src/consumer/contract/ListenerInterface.php +++ b/src/consumer/contract/ListenerInterface.php @@ -5,4 +5,6 @@ namespace tm\xls\rocketMq\thinkphp\consumer\contract; interface ListenerInterface { public function handle(); + + public function enable(); } \ No newline at end of file diff --git a/src/route.php b/src/route.php index 90fc111..8af73cd 100644 --- a/src/route.php +++ b/src/route.php @@ -7,14 +7,13 @@ use function React\Async\coroutine; $path = config('rocket_mq.callback', '/rocketmq/producer/notify'); //注册回调路由 Route::post($path, function () { - $promise = coroutine(function () { + coroutine(function () { app()->make(Consumer::class, [ request()->param() ])->distribute(); - }); - $promise->then(function () { - return 'success'; + })->then(function () { + echo 'success'; },function (){ - return 'error'; + echo 'error'; }); }); \ No newline at end of file