mkelcik / trf-consumer-base
This package is abandoned and no longer maintained.
No replacement package was suggested.
There is no license information available for the latest version (v0.1.4) of this package.
Foundation for simple try-retry-fail MQ consumer
v0.1.4
2019-07-07 20:57 UTC
Requires
- php: ^7.1.3
- php-amqplib/php-amqplib: ^2.8
- symfony/event-dispatcher: ^4.2
Requires (Dev)
- phpstan/phpstan: ^0.11.4
This package is not auto-updated.
Last update: 2024-01-29 19:53:19 UTC
README
$connection = new PhpAmqpLib\Connection\AMQPStreamConnection('192.168.0.115', 5672, 'test', 'test', 'testing');
$driver = new \TRFDrivers\RabbitMQ\Driver($connection);
$consumer = new TRFConsumer\Consumer($driver, 'my-consumer-tag', 5);
// consume 'Testing' queue
$consumer->consume("Testing", function (TRFConsumer\Interfaces\MQMessage $message) {
// print msg content
var_dump($message->body());
//process msg ...
//Exception happened, message will be send to Testing-retry queue to be processed later, after 5 unsuccessful attempts will be send to Testing-fail queue
throw new \Exception("Process error, retry processing later");
});