innmind / rabbitmq-management
Abstraction for the rabbitmq management
3.2.0
2023-09-23 09:25 UTC
Requires
- php: ~8.1
- innmind/immutable: ~4.5|~5.0
- innmind/server-control: ~4.2|~5.0
- innmind/time-continuum: ~3.0
- innmind/url: ~4.1
Requires (Dev)
- innmind/coding-standard: ~2.0
- phpunit/phpunit: ~9.0
- vimeo/psalm: ~5.12
README
Wrapper for the rabbitmqadmin
command.
Installation
composer require innmind/rabbitmq-management
Usage
use Innmind\RabbitMQ\Management\{ Status, Control, }; use Innmind\OperatingSystem\Factory; $os = Factory::build(); $status = Status::of( $os->control(), $os->clock(), ); $status->users(); $status->vhosts(); $status->connections(); $status->exchanges(); $status->permissions(); $status->channels(); $status->consumers(); $status->queues(); $status->nodes(); $control = Control::of($server); $control->users(); $control->vhosts(); $control->permissions();
Essentially this will run rabbitmqadmin list {element}
on the server and extract informations.
If you need to list the information of a remote server, then you can simply do this:
use Innmind\RabbitMQ\Management\Status\Environment\Remote; use Innmind\Url\{ Authority\Host, Authority\Port, Path, }; Status::of( $os->control(), $os->clock(), Remote::of( Host::of('your-host'), Port::of(1337), 'username', 'password', Path::of('/some-vhost'), ), );
However for this to work you need to have rabbitmqadmin
installed on the machine this code will run.
In case you don't have the command on the machine, you can replace $os->control()
by $os->remote()->ssh(/*...*/)
so it will use ssh
to run the command on the machine (and you will need to remove the third argument from Status::of()
).