|
@@ -102,6 +102,10 @@ class Mq{
|
|
|
if($callback !== null){
|
|
if($callback !== null){
|
|
|
try{
|
|
try{
|
|
|
$result = $callback(json_decode($message->body));
|
|
$result = $callback(json_decode($message->body));
|
|
|
|
|
+ if(\App\Tools\Tools::isStop()){
|
|
|
|
|
+ Log::debug('mq worker: .stop file exist. cancel the consumer.');
|
|
|
|
|
+ $message->getChannel()->basic_cancel($message->getConsumerTag());
|
|
|
|
|
+ }
|
|
|
if($result !== 0){
|
|
if($result !== 0){
|
|
|
throw new \Exception('task error');
|
|
throw new \Exception('task error');
|
|
|
}
|
|
}
|
|
@@ -124,6 +128,7 @@ class Mq{
|
|
|
}
|
|
}
|
|
|
$message->ack();
|
|
$message->ack();
|
|
|
|
|
|
|
|
|
|
+
|
|
|
// Send a message with the string "quit" to cancel the consumer.
|
|
// Send a message with the string "quit" to cancel the consumer.
|
|
|
/*
|
|
/*
|
|
|
if ($message->body === 'quit') {
|
|
if ($message->body === 'quit') {
|