Skip to content

IRecoveryPolicy with Extensions.DependencyInjection #442

Answered by Havret
Nimistren asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @Nimistren,

You can set RecoveryPolicy via ConfigureConnectionFactory method:

public void ConfigureServices(IServiceCollection services)
{
    services.AddActiveMq(name: "my-artemis-cluster",
            endpoints: new[]
            {
                Endpoint.Create(host: "localhost", port: 5672, "artemis", "artemis"),
            })
        .ConfigureConnectionFactory((_, factory) =>
        {
            factory.RecoveryPolicy = RecoveryPolicyFactory.ExponentialBackoff(
                initialDelay: TimeSpan.FromSeconds(1),
                maxDelay: TimeSpan.FromSeconds(30),
                retryCount: 5);
        });
}

And here is the working example:
https://github.com/Havret/do…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Havret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants