PHP code example of ekomobile / retry
1. Go to this page and download the library: Download ekomobile/retry library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ekomobile / retry example snippets
(new Retry(function () {
// workload ...
}))();
$operation = function () {
// workload ...
if ($somePermanentFailCondition) {
throw new \Ekomobile\Retry\Exception\Permanent(new \Exception('Unretryable error'))
}
// ...
throw new Exception('Retryable error')
};
$backoff = new \Ekomobile\Retry\Backoff\WithMaxRetries(new \Ekomobile\Retry\Backoff\Exponential(), 5);
$notify = function (\Throwable $e) {
// $logger->log($e);
};
$retry = new \Ekomobile\Retry\Retry($operation, $backoff, $notify);
$retry();