PHP code example of daalvand / retry-policy

1. Go to this page and download the library: Download daalvand/retry-policy 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/ */

    

daalvand / retry-policy example snippets



//...
/** @var App $app */
$app->register(Daalvand\RetryPolicy\RetryPolicyServiceProvider::class);


/** @var App $app */
$app->configure("retry-policy");


use \Daalvand\RetryPolicy\Contracts\Retryable;
//Custom Class
class CustomRetryable extends Retryable
{
    public function execute() : bool
    {
        // TODO: Implement execute() method.
    }
}

#### Create an object from custom retryable
use Daalvand\RetryPolicy\Facades\RetryContext;
$retryable = new CustomRetryable();
$retryable
->setMaxRequeue(20)
->setMaxRetry(2)
->setRetryDelay(10)
->setRqueueDelay(3600);

//retry retryables
RetryContext::perform([$retryable]);