Retry Plugin for EightPointsGuzzleBundle

Overview

GuzzleBundleRetryPlugin

Build Status Coverage Status

Requirements

Installation

Using composer:

composer.json
{
    "require": {
        "eugenganshorn/guzzle-bundle-retry-plugin": "^1.0"
    }
}
command line
$ composer require eugenganshorn/guzzle-bundle-retry-plugin

Usage

Enable bundle

Symfony 2.x and 3.x

Plugin will be activated/connected through bundle constructor in app/AppKernel.php, like this:

new EightPoints\Bundle\GuzzleBundle\EightPointsGuzzleBundle([
    new EugenGanshorn\Bundle\GuzzleBundleRetryPlugin\GuzzleBundleRetryPlugin(),
])

Symfony 4

The registration of bundles was changed in Symfony 4 and now you have to change src/Kernel.php to achieve the same functionality.
Find next lines:

foreach ($contents as $class => $envs) {
    if (isset($envs['all']) || isset($envs[$this->environment])) {
        yield new $class();
    }
}

and replace them by:

foreach ($contents as $class => $envs) {
    if (isset($envs['all']) || isset($envs[$this->environment])) {
        if ($class === \EightPoints\Bundle\GuzzleBundle\EightPointsGuzzleBundle::class) {
            yield new $class([
                new \EugenGanshorn\Bundle\GuzzleBundleRetryPlugin\GuzzleBundleRetryPlugin(),
            ]);
        } else {
            yield new $class();
        }
    }
}

Basic configuration

# app/config/config.yml // config/packages/eight_points_guzzle.yaml

eight_points_guzzle:
    clients:
        your_client:
            base_url: "http://api.domain.tld"

            # plugin settings
            plugin:
                retry:
                    ~

Advanced configuration

See middleware options: https://github.com/caseyamcl/guzzle_retry_middleware#options

License

This middleware is licensed under the MIT License - see the LICENSE file for details

You might also like...
Ratio plugin is a luck plugin. The more lucky you are, the more you win!
Ratio plugin is a luck plugin. The more lucky you are, the more you win!

Ratio Ratio plugin is a luck plugin. The more lucky you are, the more you win Features When you break a block (Cobblestone), it gives/puts you somethi

actionMaster is a new faction plugin that aims at flexibility and customization of the plugin by the user and the developers.

FactionMaster is a new faction plugin that aims at flexibility and customization of the plugin by the user and the developers. It includes all the basic functionality of a faction plugin and data storage in MySQL or SQLITE. This is done by adding an extension system and a translation system. FactionMaster has a will of accessibility to the players and especially not to have to remember a lot of commands to play, all is done via interface.

Api.video-wordpress-plugin - The official api.video plugin for WordPress
Api.video-wordpress-plugin - The official api.video plugin for WordPress

api.video WordPress Plugin api.video is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managin

Ied plugin composer - Inspired Plugin Composer: Create, publish and edit plugins from within Textpattern CMS.

ied_plugin_composer Create, publish and edit plugins from within Textpattern CMS. Creates a new page under the Extensions tab where you can edit and e

A Laravel 9, Vite, Svelte SPA, Tailwind CSS (w/ Forms Plugin & Aspect Ratio Plugin), Axios & TypeScript starter template.

Laravel 9 + Vite + Svelte + Tailwind CSS This starter template includes: Laravel 9 Vite Svelte Tailwind CSS (w/ @tailwindcss/forms and @tailwindcss/as

This WordPress Plugin Boilerplate is meant for you to develop your own plugin on.

WordPress Plugin Boilerplate This plugin boilerplate is meant for you to develop your own plugin on. Support & collaboration Features OOP plugin core

BetterMobs - a plugin Remixed, by MadoxMC, the original plugin is maked by tgwaste

BetterMobsOverworld BetterMobs is a plugin Remixed, by MadoxMC, the original plugin is maked by tgwaste. MadoxMC Just Edited This plugin to Make 3 Compatible Plugins to add Mobs on your Overworld Worlds, NetherWorlds & EndWorlds, MadoxMC Idea.

BetterMobs is a plugin Remixed, by MadoxMC, the original plugin is maked by tgwaste.

BetterMobs is a plugin Remixed, by MadoxMC, the original plugin is maked by tgwaste. MadoxMC Just Edited This plugin to Make 3 Compatible Plugins to add Mobs on your Overworld Worlds, NetherWorlds & EndWorlds, MadoxMC Idea.

Opinionated version of Wikimedia composer-merge-plugin to work in pair with Bamarni composer-bin-plugin.

Composer Inheritance Plugin Opinionated version of Wikimedia composer-merge-plugin to work in pair with bamarni/composer-bin-plugin. Usage If you are

This Plugin is used to install and activate multiple plugins in one go. I was facing problem uploading plugins one by one so I developed this to solve my problem. Hope you will enjoy using this plugin.

=== Bulk Plugin Installer === Contributors: jawadarshad Donate link: https://jawadarshad.io/ Tags: bulk plugin installer, import multiple plugins, up

composer parallel install plugin
composer parallel install plugin

prestissimo (composer plugin) This is a composer 1.x plugin that downloads packages in parallel to speed up the installation process. Announcement: Co

:musical_note: Provides a composer plugin for normalizing composer.json.
:musical_note: Provides a composer plugin for normalizing composer.json.

composer-normalize Provides a composer plugin for normalizing composer.json. Why When it comes to formatting composer.json, you have the following opt

A MySQL Workbench plugin which exports a Model to Laravel 5 Migrations

MySQL Workbench Export Laravel 5 Migrations Plugin A MySQL Workbench plugin that allows for exporting a model to Laravel 5 migrations that follow PSR-

Laravel Impersonate is a plugin that allows you to authenticate as your users.

Laravel Impersonate Laravel Impersonate makes it easy to authenticate as your users. Add a simple trait to your user model and impersonate as one of y

An asset compression plugin for CakePHP. Provides file concatenation and a flexible filter system for preprocessing and minification.

Asset Compress Asset Compress is CakePHP plugin for helping reduce the number of requests, and optimizing the remaining requests your application make

:cake: Less parser plugin for CakePHP

Less parser plugin for CakePHP 3.X This plugin has a helper to help you parsing .less files in CakePHP 3.0 applications. By default, the helper will p

CakePHP Minify HTML Plugin

MinifyHtml CakePHP 4, HTML Minify Plugin Installation To install via Composer, use the command below, it will automatically detect the latest version

DatabaseLog CakePHP plugin to log into DB instead of files. Better to filter and search.

CakePHP DatabaseLog Plugin DatabaseLog engine for CakePHP applications. This branch is for CakePHP 4.0+. See version map for details. Features Easy se

Comments
  • Logger doesn't allow null response

    Logger doesn't allow null response

    You already have commit that solve this in 1.1.* version ( https://github.com/EugenGanshorn/GuzzleBundleRetryPlugin/pull/1/commits/d60c9174b2e60fdaa1ad581da74cd0d27703b37a ), but we can't use v1.1 for symfony 4 . This fix also should be in 1.0.* branch

    opened by cavemanlu 2
  • Dependency on a non-existent logging service when EightPointsGuzzleBundle logging is disabled

    Dependency on a non-existent logging service when EightPointsGuzzleBundle logging is disabled

    There is a dependency on the eight_points_guzzle logger class. When logging is disabled on eight_points_guzzle this class is not defined by the extension.

    This gives the following error;

    The service "guzzle_bundle_retry_plugin.middleware.retry.xxx" has a dependency on a non-existent service "eight_points_guzzle.middleware.log.class".
    

    Location:

    public function loadForClient(array $config, ContainerBuilder $container, string $clientName, Definition $handler): void
    {
        if ($config['retry_enabled']) {
            $logger = new Definition(Logger::class);
            $logger->addMethodCall('setLogger', [new Reference('monolog.logger.eight_points_guzzle')]);
            $logger->addMethodCall('setFormatter', [new Reference('eight_points_guzzle.symfony_log_formatter')]);
    
            $middleware = new Definition(GuzzleRetryMiddleware::class);
            $middleware->setFactory([GuzzleRetryMiddleware::class, 'factory']);
            $middleware->setArguments([
                [
                    'max_retry_attempts'               => $config['max_retry_attempts'],
                    'retry_only_if_retry_after_header' => $config['retry_only_if_retry_after_header'],
                    'retry_on_status'                  => $config['retry_on_status'],
                    'default_retry_multiplier'         => $config['default_retry_multiplier'],
                    'retry_on_timeout'                 => $config['retry_on_timeout'],
                    'expose_retry_header'              => $config['expose_retry_header'],
                    'retry_header'                     => $config['retry_header'],
                    'on_retry_callback'                => [$logger, 'callback'],
                ],
            ]);
    
    opened by Stollie 1
  • Prepare bundle for Symfony 5

    Prepare bundle for Symfony 5

    Hi every body. We prepared this bundle for Symfony 5. Also an error with logger was fixed. The last argument was null, when timeout connection happened.

    opened by sane4ek-2 1
Releases(1.3.0)
Owner
Eugen Ganshorn
Eugen Ganshorn
YOURLS QRCode plugin with exposed options and full integration

YOURLS-IQRCodes YOURLS Integrated QRCodes plugin with exposed options and full integration This is an updated fork of Inline QRCode which is more comp

Josh Panter 17 Oct 4, 2021
PHP library providing retry functionality with multiple backoff strategies and jitter support

PHP Backoff Easily wrap your code with retry functionality. This library provides: 4 backoff strategies (plus the ability to use your own) Optional ji

Signature Tech Studio 145 Dec 21, 2022
Automatically retry non-atomic upsert operation when unique key constraints are violated.

Laravel Retry on Duplicate Key Automatically retry non-atomic upsert operation when unique constraints are violated. e.g. firstOrCreate() updateOrCrea

mpyw 8 Dec 7, 2022
Tiny PHP library providing retry functionality with multiple backoff strategies and jitter support

JBZoo / Retry 4 retry strategies (plus the ability to use your own) Optional jitter / randomness to spread out retries and minimize collisions Wait ti

JBZoo Toolbox 6 Dec 19, 2022
If you are beginner in WordPress plugin development or if you want to develop your own store product plugin you use this plugin

hirwa-products-plugin If you are beginner in WordPress plugin development or if you want to develop your own store product plugin you use this plugin

NIYIBIZI HIRWA 1 Aug 23, 2022
A plugin manager for PocketMine-MP downloads plugin from PocketMine-MP official plugin repository

oh-my-pmmp A plugin manager for PocketMine-MP Getting Started Prerequisites Your server MUST RUN the latest version of PocketMine. Installation From P

thebigcrafter 6 Jan 4, 2023
Integrates the ClassicPress Plugin Directory and any plugin stored in GitHub (tagged with classicpress-plugin) in the ClassicPress Admin

ClassicPress Plugin Directory Adds a new screen in a ClassicPress Install where you can browse, install, activate, deactivate, update, delete and pagi

TukuToi 3 Dec 27, 2022
This Pocketmine-MP plugin is a plugin including a complete faction system.

SimpleFaction Simple faction plugin replacing FactionsPro which is no longer updated. Commands Command Name Command Description Available for /f help

Ayzrix 33 Dec 19, 2022
Botble plugin comment is a comment plugin for Botble CMS

Botble plugin comment This is a plugin for Botble CMS so you have to purchase Botble CMS first to use this plugin.

Bảo Bối 27 Nov 25, 2021
SpawnInLobby Pocketmine-MP plugin. With this plugin the player will always join the game at the default world spawn point

SpawnInLobby Pocketmine-MP plugin. With this plugin the player will always join the game at the default world spawn point

null 1 Jan 7, 2022