crutch / consumer-handler-retry
consumer retry handler
v1.0.0
2023-01-19 11:54 UTC
Requires
- php: ^7.4 || ^8.0
- crutch/consumer: ^1.0
- crutch/producer: ^1.0
Provides
This package is not auto-updated.
Last update: 2024-11-08 03:24:27 UTC
README
consumer handler for retrying failed messages
Install
composer require crutch/consumer-handler-retry
<?php /** @var Crutch\Producer\Producer $retryProducer */ /** @var Crutch\Consumer\ConsumerHandler $handler */ /** @var null|Crutch\RetryConsumerHandler\TopicStrategy\TopicStrategy $topicStrategy */ /** @var null|Crutch\RetryConsumerHandler\DelayStrategy\DelayStrategy $delayStrategy */ /** @var null|int $maxAttempts */ $retryHandler = new Crutch\RetryConsumerHandler\RetryConsumerHandler( $handler, $retryProducer, $topicStrategy, $delayStrategy, $maxAttempts ); /** * if $handler throws exception, $retryProducer produced message to topic, defined by $topicStrategy * with delay, calculated by $selayStrategy. */ $retryHandler->handle('message 1', 'one'); // handled by $topicOneHandler