29 lines
494 B
PHP
29 lines
494 B
PHP
|
<?php
|
||
|
|
||
|
namespace example;
|
||
|
|
||
|
|
||
|
use tm\xls\rocketMq\thinkphp\consumer\contract\ListenerInterface;
|
||
|
use tm\xls\rocketMq\thinkphp\consumer\message\Message;
|
||
|
|
||
|
class Consumer implements ListenerInterface
|
||
|
{
|
||
|
|
||
|
private $message;
|
||
|
|
||
|
public function __construct(Message $message)
|
||
|
{
|
||
|
$this->message = $message;
|
||
|
}
|
||
|
|
||
|
public function handle()
|
||
|
{
|
||
|
//处理订阅逻辑
|
||
|
}
|
||
|
|
||
|
public function enable(): bool
|
||
|
{
|
||
|
// 这边判断是否执行
|
||
|
return true;
|
||
|
}
|
||
|
}
|