<?php

declare(strict_types=1);

namespace App\Amqp\Consumer;

use Hyperf\Amqp\Result;
use Hyperf\Amqp\Annotation\Consumer;
use Hyperf\Amqp\Message\ConsumerMessage;
use PhpAmqpLib\Message\AMQPMessage;
use App\JsonRpc\CollectorService;
#[Consumer(exchange: 'gather', routingKey: 'gather', queue: 'gather', name: "GatherConsumer", nums: 1, enable: true)]
class GatherConsumer extends ConsumerMessage
{
    public function consumeMessage($data, AMQPMessage $message): Result
    {
        $collectorService = new CollectorService();
        $collectorService->goCrawler($data);
        return Result::ACK;
    }
    public function isEnable(): bool
    {
        return parent::isEnable();
    }
}
