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