diff --git a/README.md b/README.md index 592ae5d..cfa0845 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,11 @@ class Consumer implements ListenerInterface private $message; + /** + * 所有订阅监听会自动注入 tm\xls\rocketMq\thinkphp\consumer\message\Message 对象 + * + * @param Message $message + */ public function __construct(Message $message) { $this->message = $message; @@ -77,7 +82,10 @@ class Consumer implements ListenerInterface public function handle() { + //队列消息 + $this->message; //处理订阅逻辑 + // code ... } public function enable(): bool diff --git a/src/consumer/Consumer.php b/src/consumer/Consumer.php index 6e3075b..aa15727 100644 --- a/src/consumer/Consumer.php +++ b/src/consumer/Consumer.php @@ -29,7 +29,7 @@ class Consumer { //事件循环 $loop = Loop::get(); - $key = $this->message->getTopic().$this->message->getTag(); + $key = $this->message->getTopic().'.'.$this->message->getTag(); $subscribes = $this->getSubscribe()[$key] ?? []; foreach ($subscribes as $subscribe) { $loop->addTimer(0, function () use ($subscribe) {