Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added options which allow the configuration of endpoint initialization #18

Merged
merged 3 commits into from
Aug 25, 2020

Conversation

mikoskinen
Copy link
Contributor

Affects the endpoint initialization scenario where the api contains an ApiFactory. For example the retry policy for initialization can now be configured.

To configure settings for a single named endpoint one can use:

        services.Configure<EndpointInitializationOptions>("dynamictest", options =>
        {
            options.RetryCount = 200;
        });

Where "dynamictest" is the name of the api.

To configure the default settings for all the endpoints, one can use:

        services.ConfigureAll<EndpointInitializationOptions>(options =>
        {
            options.RetryCount = 5;
        });

To retry forever, use:

        services.Configure<EndpointInitializationOptions>("myapi", options =>
        {
            options.RetryCount = null;
        });

To send an email after 5 failed attempts, use:

        services.Configure<EndpointInitializationOptions>("dynamictest", options =>
        {
            options.RetryCount = null;

            options.OnBeforeUpdatingInitializationFailedStatus = async (endpoint, exception, retryCount, statusMessage) =>
            {
                if (retryCount == 5)
                {
                    await SendEmail(exception, endpoint);
                }
            };
        });

@tsilvonen tsilvonen merged commit 1faf1c6 into master Aug 25, 2020
@tsilvonen tsilvonen deleted the customizeretry branch August 25, 2020 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants