rxthunder / rabbitmq
RabbitMQ library for RxThunder
Installs: 2 062
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 1
Requires
- php: ^7.4
- rxnet/rabbitmq: ^0.3.0
- rxthunder/core: ^1.0.1
- rxthunder/react-php: ^1.0
- symfony/finder: ^4.0|^5.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- phpstan/phpstan: ^0.12.0
- youdot/coding-standard: ^2.0
README
Installation
composer install rxthunder/rabbitmq
Setup
First you must add new secrets in your .env files
# .env
RABBIT_HOST=
RABBIT_PORT=
RABBIT_VHOST=
RABBIT_USER=
RABBIT_PASSWORD=
Then configure new parameters to be injected in the container
# config/parameters.php $container->setParameter('rabbit.host', getenv('RABBIT_HOST')); $container->setParameter('rabbit.port', getenv('RABBIT_PORT')); $container->setParameter('rabbit.vhost', getenv('RABBIT_VHOST')); $container->setParameter('rabbit.user', getenv('RABBIT_USER')); $container->setParameter('rabbit.password', getenv('RABBIT_PASSWORD'));
Finally you must register an instance of RxNet/RabbitMq client in the container.
You can do your own factory but a default one is embed in the plugin using the voryx/event-loop static getter.
# config/services.php use Rxnet\RabbitMq\Client; use RxThunder\RabbitMQ\Factory; $asynchRabbitMQDefinition = $container->register(Client::class) ->setFactory([Factory::class, 'createWithVoryxEventLoop']) ->addArgument('%rabbit.host%') ->addArgument('%rabbit.port%') ->addArgument('%rabbit.vhost%') ->addArgument('%rabbit.user%') ->addArgument('%rabbit.password%') ->setPublic(false) ->setAutowired(false) ->setAutoconfigured(true);
# config/services.php require_once __DIR__ . '/../vendor/rxthunder/rabbitmq/config/services.php'; // Register RabbitMQ consoles $consoleDefinition = new Definition(); $consoleDefinition->setPublic(true); $consoleDefinition->setAutowired(true); $consoleDefinition->setAutoconfigured(true); $this->registerClasses($consoleDefinition, 'RxThunder\\RabbitMQ\\Console\\', '../vendor/rxthunder/rabbitmq/src/Console/*');
Or if you prefer you can include
# config/services.php require_once __DIR__ . '/../vendor/rxthunder/rabbitmq/config/services.php'; require_once __DIR__ . '/../vendor/rxthunder/rabbitmq/config/consoles.php';
Profit
You got new consoles !
php vendor/bin/thunder