Download the PHP package makaronnik/amphp-rabbitmq-manager without Composer
On this page you can find all versions of the php package makaronnik/amphp-rabbitmq-manager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download makaronnik/amphp-rabbitmq-manager
More information about makaronnik/amphp-rabbitmq-manager
Files in makaronnik/amphp-rabbitmq-manager
Package amphp-rabbitmq-manager
Short Description PHP (8.1) Async Manager for RabbitMQ connection and consuming process. Wrapper over PHPinnacle Ridge
License MIT
Homepage https://github.com/makaronnik/amphp-rabbitmq-manager
Informations about the package amphp-rabbitmq-manager
Amphp RabbitMQ Manager
PHP (8.1) Async Manager for RabbitMQ connection and channels, which is a wrapper over PHPinnacle Ridge library, based on Amp
Installation
This package can be installed as a Composer dependency.
Requirements
- PHP 8.1+
What is this manager used for?
- To get the connected client (PHPinnacle\Ridge\Client). In case of unsuccessful connection (an exception occurs), it attempts to reconnect (the number of attempts is configured in the manager's constructor). When AsyncEvent is configured, an event is emitted that a connection has been made.
- To get the active channel (PHPinnacle\Ridge\Channel) by its name. Before that, the manager verifies the connection and, if necessary, performs the connection process.
- To handle an exceptional disconnect. With a logger configured and an exception passed, a log entry is made. When AsyncEvent is configured, an event is emitted that the connection is lost.
Basic Usage
Use case
If you run your application in a containerized environment (eg Docker Compose), in most cases your application will start much faster than the RabbitMQ container is ready to go. This will throw an exception in your application when trying to create a connected client. You will need to catch this exception yourself and attempt to reconnect at a certain interval and number of attempts.
You can use the dockerize utility to run your application after the RabbitMQ server is ready to respond to requests:
But, some rebbit images, like bitnami/rabbitmq, do a pre-configuration run first, and then restart the server in production mode. This behavior will trick your dockerize into giving it a response in the first stage of startup, then your application will start up and get an exception when trying to connect to RabbitMQ as the server will go into a restart.
In this case, it would be wise to use dockerize to get the first response from the server, and amphp-rabbitmq-manager to successfully get a connection after your application has started.
Versioning
makaronnik/amphp-rabbitmq-manager
follows the semver semantic versioning specification.
License
The MIT License (MIT). Please see LICENSE
for more information.
All versions of amphp-rabbitmq-manager with dependencies
amphp/amp Version v2.6.*
kelunik/retry Version ^v1
phpinnacle/ridge Version 1.3.*
cspray/labrador-async-event Version ^2