phuongna/rabbitmq

Follow guide https://www.rabbitmq.com/ to create a library easy to use. For Laravel!

1.1.9 2022-05-24 04:18 UTC

This package is auto-updated.

Last update: 2024-05-24 08:46:35 UTC


README

Installation

Install via composer

composer require phuongna/rabbitmq

Publish package assets

php artisan vendor:publish --provider="phuongna\rabbitmq\ServiceProvider"

Security

If you discover any security related issues, please email instead of using the issue tracker.

How to use

####Server as service

$this->rabbit = app('rabbitmq.queue')->connection('rabbitmq');
RabbitMQQueue::declareRPCServer($this->rabbit, xxx, function ($request) {
    $this->rabbit->replyTo($request, dosomething($request));
});

####Client as service

$this->rabbit = app('rabbitmq.queue')->connection('rabbitmq');
$stringInput = json_encode(array);
RabbitMQQueue::declareRPCClient($this->rabbit, xxx, $stringInput);