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 support for using IServiceProvider when configuring Rabbitmq #915

Merged
merged 32 commits into from
Feb 23, 2022

Conversation

isdaniel
Copy link
Contributor

What this PR does / why we need it:

This pull request is supported for configuring the connection and option using an IServiceProvider similar to how the SqlServerHealthCheck supports this for a connection string & Uri.

So instead of this:

var provider = services.BuildServiceProvider();
var settings = services.GetRequiredService<IOptions>();

We need to set string type for Rabbitmq connection from heartbeat before.

services.AddHealthChecks().AddRabbitMQ("Connectionstring");

You can now do something like the code below.

//for connection string
services.AddHealthChecks().AddRabbitMQ(sp => services.GetRequiredService<IOptions>().Value.RabbitmqConnectionString);

//for uri string
services.AddHealthChecks().AddRabbitMQ(sp => services.GetRequiredService<IOptions>().Value.RabbitmqConnectionString);

Special notes for your reviewer:

This is based on the connectionStringFactory implementation in the SqlServerHealthCheck.

I had added some unit tests & functional tests for this feature, I passed by this picture below

image

Does this PR introduce a user-facing change?:

Please make sure you've completed the relevant tasks for this PR, out of the following list:

It extends but does not break the existing options for configuring a RabbitMQ HealthCheck

  • Code compiles correctly
  • Created/updated tests
  • Unit tests passing
  • End-to-end tests passing
  • Extended the documentation
  • Provided sample for the feature

DD-6677 and others added 17 commits February 18, 2022 11:53
…uilderExtensions.cs

Co-authored-by: Ivan Maximov <sungam3r@yandex.ru>
…nTests.cs

Co-authored-by: Ivan Maximov <sungam3r@yandex.ru>
…uilderExtensions.cs

Co-authored-by: Ivan Maximov <sungam3r@yandex.ru>
…uilderExtensions.cs

Co-authored-by: Ivan Maximov <sungam3r@yandex.ru>
…uilderExtensions.cs

Co-authored-by: Ivan Maximov <sungam3r@yandex.ru>
…uilderExtensions.cs

Co-authored-by: Ivan Maximov <sungam3r@yandex.ru>
…ts.cs

Co-authored-by: Ivan Maximov <sungam3r@yandex.ru>
…uilderExtensions.cs

Co-authored-by: Ivan Maximov <sungam3r@yandex.ru>
@sungam3r
Copy link
Collaborator

@isdaniel I merged #912 and #913 that affect your PR. Please rebase it onto master.

@isdaniel
Copy link
Contributor Author

@sungam3r I had edited my PR & tried to rebase onto master, I seldom do rebase I am not sure that is correct

@sungam3r sungam3r merged commit 5461a83 into Xabaril:master Feb 23, 2022
@sungam3r sungam3r added the enhancement New feature or request label Feb 23, 2022
@sungam3r sungam3r mentioned this pull request Feb 23, 2022
@sungam3r sungam3r mentioned this pull request Jul 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants