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

Resolve clients from KeyedServices #2273

Open
Alirexaa opened this issue Aug 1, 2024 · 0 comments
Open

Resolve clients from KeyedServices #2273

Alirexaa opened this issue Aug 1, 2024 · 0 comments

Comments

@Alirexaa
Copy link
Collaborator

Alirexaa commented Aug 1, 2024

What would you like to be added:
We already support resolving clients from ServiceProvider in some packages.
For example, we did this in the Elasticsearch package:

public static IHealthChecksBuilder AddElasticsearch(
this IHealthChecksBuilder builder,
Func<IServiceProvider, Elastic.Clients.Elasticsearch.ElasticsearchClient>? clientFactory = null,
string? name = default,
HealthStatus? failureStatus = default,
IEnumerable<string>? tags = default,
TimeSpan? timeout = default)
{

I strongly suggest supporting resolving clients from KeyedServices.

For instance, in the Elasticsearch package it would be something like this:

+ public static IHealthChecksBuilder AddKeyedElasticsearch(this IHealthChecksBuilder builder, object keyServiceName, string? name = default, HealthStatus? failureStatus = default, IEnumerable<string>? tags = default, TimeSpan? timeout = default);

Why is this needed:

Some users use AddKeyedService to register clients, so if the user wants to use the same client in the health check he or she should do more work to reach this goal.

We should support this kind of registration in our packages.

cc @adamsitnik @unaizorrilla

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

No branches or pull requests

1 participant