mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-21 16:38:37 -06:00
Renamed Rabbit instances to use RabbitMq
This commit is contained in:
parent
cb1705b6e8
commit
8e5730f374
@ -34,10 +34,11 @@ The idea is that you can just generate a container using the image and provide t
|
||||
|
||||
First, make sure the host where you are going to run shlink fulfills these requirements:
|
||||
|
||||
* PHP 8.0
|
||||
* PHP 8.0 or 8.1
|
||||
* The next PHP extensions: json, curl, pdo, intl, gd and gmp.
|
||||
* apcu extension is recommended if you don't plan to use swoole or openswoole.
|
||||
* xml extension is required if you want to generate QR codes in svg format.
|
||||
* sockets and bcmath extensions are required if you want to integrate with a RabbitMQ instance.
|
||||
* MySQL, MariaDB, PostgreSQL, Microsoft SQL Server or SQLite.
|
||||
* The web server of your choice with PHP integration (Apache or Nginx recommended).
|
||||
|
||||
|
@ -10,10 +10,10 @@ use function Shlinkio\Shlink\Common\env;
|
||||
|
||||
return [
|
||||
|
||||
'rabbit' => [
|
||||
'rabbitmq' => [
|
||||
'enabled' => (bool) env('RABBITMQ_ENABLED', false),
|
||||
'host' => env('RABBITMQ_HOST'),
|
||||
'port' => env('RABBITMQ_PORT', '5672'),
|
||||
'port' => (int) env('RABBITMQ_PORT', '5672'),
|
||||
'user' => env('RABBITMQ_USER'),
|
||||
'password' => env('RABBITMQ_PASSWORD'),
|
||||
'vhost' => env('RABBITMQ_VHOST', '/'),
|
||||
@ -37,11 +37,11 @@ return [
|
||||
|
||||
ConfigAbstractFactory::class => [
|
||||
AMQPStreamConnection::class => [
|
||||
'config.rabbit.host',
|
||||
'config.rabbit.port',
|
||||
'config.rabbit.user',
|
||||
'config.rabbit.password',
|
||||
'config.rabbit.vhost',
|
||||
'config.rabbitmq.host',
|
||||
'config.rabbitmq.port',
|
||||
'config.rabbitmq.user',
|
||||
'config.rabbitmq.password',
|
||||
'config.rabbitmq.vhost',
|
||||
],
|
||||
],
|
||||
|
||||
|
@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
return [
|
||||
|
||||
'rabbit' => [
|
||||
'rabbitmq' => [
|
||||
'enabled' => true,
|
||||
'host' => 'shlink_rabbitmq',
|
||||
'user' => 'rabbit',
|
||||
|
@ -23,7 +23,7 @@ return [
|
||||
'async' => [
|
||||
EventDispatcher\Event\VisitLocated::class => [
|
||||
EventDispatcher\NotifyVisitToMercure::class,
|
||||
EventDispatcher\NotifyVisitToRabbit::class,
|
||||
EventDispatcher\NotifyVisitToRabbitMq::class,
|
||||
EventDispatcher\NotifyVisitToWebHooks::class,
|
||||
EventDispatcher\UpdateGeoLiteDb::class,
|
||||
],
|
||||
@ -35,7 +35,7 @@ return [
|
||||
EventDispatcher\LocateVisit::class => ConfigAbstractFactory::class,
|
||||
EventDispatcher\NotifyVisitToWebHooks::class => ConfigAbstractFactory::class,
|
||||
EventDispatcher\NotifyVisitToMercure::class => ConfigAbstractFactory::class,
|
||||
EventDispatcher\NotifyVisitToRabbit::class => ConfigAbstractFactory::class,
|
||||
EventDispatcher\NotifyVisitToRabbitMq::class => ConfigAbstractFactory::class,
|
||||
EventDispatcher\UpdateGeoLiteDb::class => ConfigAbstractFactory::class,
|
||||
],
|
||||
|
||||
@ -43,7 +43,7 @@ return [
|
||||
EventDispatcher\NotifyVisitToMercure::class => [
|
||||
EventDispatcher\CloseDbConnectionEventListenerDelegator::class,
|
||||
],
|
||||
EventDispatcher\NotifyVisitToRabbit::class => [
|
||||
EventDispatcher\NotifyVisitToRabbitMq::class => [
|
||||
EventDispatcher\CloseDbConnectionEventListenerDelegator::class,
|
||||
],
|
||||
EventDispatcher\NotifyVisitToWebHooks::class => [
|
||||
@ -74,12 +74,12 @@ return [
|
||||
'em',
|
||||
'Logger_Shlink',
|
||||
],
|
||||
EventDispatcher\NotifyVisitToRabbit::class => [
|
||||
EventDispatcher\NotifyVisitToRabbitMq::class => [
|
||||
AMQPStreamConnection::class,
|
||||
'em',
|
||||
'Logger_Shlink',
|
||||
Visit\Transformer\OrphanVisitDataTransformer::class,
|
||||
'config.rabbit.enabled',
|
||||
'config.rabbitmq.enabled',
|
||||
],
|
||||
EventDispatcher\UpdateGeoLiteDb::class => [GeolocationDbUpdater::class, 'Logger_Shlink'],
|
||||
],
|
||||
|
@ -17,7 +17,7 @@ use Throwable;
|
||||
use function Shlinkio\Shlink\Common\json_encode;
|
||||
use function sprintf;
|
||||
|
||||
class NotifyVisitToRabbit
|
||||
class NotifyVisitToRabbitMq
|
||||
{
|
||||
private const NEW_VISIT_QUEUE = 'https://shlink.io/new-visit';
|
||||
private const NEW_ORPHAN_VISIT_QUEUE = 'https://shlink.io/new-orphan-visit';
|
@ -18,7 +18,7 @@ use RuntimeException;
|
||||
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
||||
use Shlinkio\Shlink\Core\Entity\Visit;
|
||||
use Shlinkio\Shlink\Core\EventDispatcher\Event\VisitLocated;
|
||||
use Shlinkio\Shlink\Core\EventDispatcher\NotifyVisitToRabbit;
|
||||
use Shlinkio\Shlink\Core\EventDispatcher\NotifyVisitToRabbitMq;
|
||||
use Shlinkio\Shlink\Core\Model\ShortUrlMeta;
|
||||
use Shlinkio\Shlink\Core\Model\Visitor;
|
||||
use Shlinkio\Shlink\Core\Visit\Transformer\OrphanVisitDataTransformer;
|
||||
@ -27,11 +27,11 @@ use Throwable;
|
||||
use function count;
|
||||
use function Functional\contains;
|
||||
|
||||
class NotifyVisitToRabbitTest extends TestCase
|
||||
class NotifyVisitToRabbitMqTest extends TestCase
|
||||
{
|
||||
use ProphecyTrait;
|
||||
|
||||
private NotifyVisitToRabbit $listener;
|
||||
private NotifyVisitToRabbitMq $listener;
|
||||
private ObjectProphecy $connection;
|
||||
private ObjectProphecy $em;
|
||||
private ObjectProphecy $logger;
|
||||
@ -49,7 +49,7 @@ class NotifyVisitToRabbitTest extends TestCase
|
||||
$this->em = $this->prophesize(EntityManagerInterface::class);
|
||||
$this->logger = $this->prophesize(LoggerInterface::class);
|
||||
|
||||
$this->listener = new NotifyVisitToRabbit(
|
||||
$this->listener = new NotifyVisitToRabbitMq(
|
||||
$this->connection->reveal(),
|
||||
$this->em->reveal(),
|
||||
$this->logger->reveal(),
|
||||
@ -61,7 +61,7 @@ class NotifyVisitToRabbitTest extends TestCase
|
||||
/** @test */
|
||||
public function doesNothingWhenTheFeatureIsNotEnabled(): void
|
||||
{
|
||||
$listener = new NotifyVisitToRabbit(
|
||||
$listener = new NotifyVisitToRabbitMq(
|
||||
$this->connection->reveal(),
|
||||
$this->em->reveal(),
|
||||
$this->logger->reveal(),
|
Loading…
Reference in New Issue
Block a user