From ed81c17501a3a10e94e19effd192e9ffcfd79c3b Mon Sep 17 00:00:00 2001 From: weigang Date: Wed, 5 Aug 2020 15:34:32 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=88=B8=E8=BF=94=E5=88=B8=E6=B6=88=E6=81=AF=E9=98=9F=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Amqp/Consumer/couponRebateConsumer.php | 28 ++++++++++++++++++ config/autoload/amqp.php | 33 ++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 app/Amqp/Consumer/couponRebateConsumer.php create mode 100644 config/autoload/amqp.php diff --git a/app/Amqp/Consumer/couponRebateConsumer.php b/app/Amqp/Consumer/couponRebateConsumer.php new file mode 100644 index 0000000..7b04668 --- /dev/null +++ b/app/Amqp/Consumer/couponRebateConsumer.php @@ -0,0 +1,28 @@ +getBody()); + return Result::ACK; + } + + public function isEnable(): bool + { + return parent::isEnable(); + } +} diff --git a/config/autoload/amqp.php b/config/autoload/amqp.php new file mode 100644 index 0000000..e14780a --- /dev/null +++ b/config/autoload/amqp.php @@ -0,0 +1,33 @@ + [ + 'host' => env('RQM_HOST', 'localhost'), + 'port' => 5672, + 'user' => env('RQM_USER','guest'), + 'password' => env('RQM_PASSWORD','guest'), + 'vhost' => '/', + 'concurrent' => [ + 'limit' => 1, + ], + 'pool' => [ + 'min_connections' => 1, + 'max_connections' => 10, + 'connect_timeout' => 10.0, + 'wait_timeout' => 3.0, + 'heartbeat' => -1, + ], + 'params' => [ + 'insist' => false, + 'login_method' => 'AMQPLAIN', + 'login_response' => null, + 'locale' => 'en_US', + 'connection_timeout' => 3.0, + 'read_write_timeout' => 6.0, + 'context' => null, + 'keepalive' => false, + 'heartbeat' => 3, + 'close_on_destruct' => false, + ], + ] +]; From 765dbccf8fa6465380e48a6ff2428b246a73f7f5 Mon Sep 17 00:00:00 2001 From: weigang Date: Wed, 5 Aug 2020 15:41:08 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=98=9F=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Amqp/Consumer/couponRebateConsumer.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Amqp/Consumer/couponRebateConsumer.php b/app/Amqp/Consumer/couponRebateConsumer.php index 7b04668..a4f7e27 100644 --- a/app/Amqp/Consumer/couponRebateConsumer.php +++ b/app/Amqp/Consumer/couponRebateConsumer.php @@ -18,6 +18,9 @@ class couponRebateConsumer extends ConsumerMessage { var_dump($data); var_dump($message->getBody()); + if (false) { + return Result::REQUEUE; + } return Result::ACK; }