$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");
});
This repository has been archived by the owner on Jan 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
mkelcik/trf-consumer
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Simple try-retry-fail consumer
Resources
Stars
Watchers
Forks
Packages 0
No packages published