op:多节点监听异常抑制

This commit is contained in:
zyimm 2023-07-11 15:23:59 +08:00
parent 4710f9c6ea
commit dc2fccbc55

View File

@ -2,6 +2,7 @@
namespace tm\xls\rocketMq\thinkphp\consumer;
use Exception;
use React\EventLoop\Loop;
use tm\xls\rocketMq\thinkphp\consumer\contract\ListenerInterface;
use tm\xls\rocketMq\thinkphp\consumer\message\Message;
@ -38,7 +39,12 @@ class Consumer
]);
if ($handler instanceof ListenerInterface) {
if ($handler->enable()) {
try {
$handler->handle();
} catch (Exception $exception) {
//todo 记录日志
return;
}
}
} else {
throw new ConsumerException('Consumer needs to implement ListenerInterface');