2024-07-18 20:20:08 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\MessageHandler;
|
|
|
|
|
|
|
|
|
|
use App\Message\UpdateRdapServers;
|
|
|
|
|
use App\Service\RDAPService;
|
|
|
|
|
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
|
2024-07-19 01:17:33 +02:00
|
|
|
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
|
|
|
|
use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface;
|
|
|
|
|
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
|
|
|
|
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
|
|
|
|
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
2024-07-19 18:59:21 +02:00
|
|
|
use Throwable;
|
2024-07-18 20:20:08 +02:00
|
|
|
|
|
|
|
|
#[AsMessageHandler]
|
|
|
|
|
final readonly class UpdateRdapServersHandler
|
|
|
|
|
{
|
|
|
|
|
public function __construct(private RDAPService $RDAPService)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-19 01:17:33 +02:00
|
|
|
/**
|
|
|
|
|
* @throws TransportExceptionInterface
|
|
|
|
|
* @throws ServerExceptionInterface
|
|
|
|
|
* @throws RedirectionExceptionInterface
|
|
|
|
|
* @throws DecodingExceptionInterface
|
2024-07-19 18:59:21 +02:00
|
|
|
* @throws ClientExceptionInterface|Throwable
|
2024-07-19 01:17:33 +02:00
|
|
|
*/
|
2024-07-18 20:20:08 +02:00
|
|
|
public function __invoke(UpdateRdapServers $message): void
|
|
|
|
|
{
|
2024-07-19 18:59:21 +02:00
|
|
|
/** @var Throwable[] $throws */
|
|
|
|
|
$throws = [];
|
|
|
|
|
try {
|
|
|
|
|
$this->RDAPService->updateTldListIANA();
|
|
|
|
|
$this->RDAPService->updateGTldListICANN();
|
|
|
|
|
} catch (Throwable $throwable) {
|
|
|
|
|
$throws[] = $throwable;
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
$this->RDAPService->updateRDAPServers();
|
|
|
|
|
} catch (Throwable $throwable) {
|
|
|
|
|
$throws[] = $throwable;
|
|
|
|
|
}
|
2024-07-23 18:11:56 +02:00
|
|
|
if (!empty($throws)) throw $throws[0];
|
2024-07-18 20:20:08 +02:00
|
|
|
}
|
|
|
|
|
}
|