Download the PHP package vrnvgasu/php-rabbit-handler without Composer
On this page you can find all versions of the php package vrnvgasu/php-rabbit-handler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package php-rabbit-handler
php-rabbit-handler
composer require vrnvgasu/php-rabbit-handler
Look examples in ./Examples
.
Connection
Create new connection.
Queue
Create new queue.
Pass '' as the first variable if you need a unique queue from rabbit.
Exchange
Create new exchange.
Bind queue and exchange
Create new binding.
You can create pass routing key in your binding.
Then you must to create helper and pass him $connection, $queue, $exchange and $binding.
Consuming
Create new consume.
You can pass callback function in Consume constructor to handle message from rabbit
Or you can extend your consumer class from Consumer and declare callback
method.
Then you must to create consumer and pass him $helper and $consume.
Then call method execute
.
If you want to interrupt the execution of the handler after a while, then use:
This will interrupt execution after the specified time after processing the last message.
Producing
Create new publication.
Then you must to create producer and pass him $helper and $publication.
You need payload for your producer. Producer can get payload from objects which implements JobInterface.
You can pass your job object to Producer object
Or you can pass producer to the method execute
.
Job
Prepare payload for producer.
Dispatch
At the first you need to transfer data for preparation to dispatch
.
Class declaration
Your TestJob must extends from Job
Handling
In TestJob you must to declare method handle
with params which you pass in dispatch
. handle
will execute in dispatch
.