Fix: Kafka replication factor hardcoded to 1 and No health check endpoints
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using Elastic.Clients.Elasticsearch;
|
||||
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||
|
||||
public sealed class ElasticsearchHealthCheck : IHealthCheck
|
||||
{
|
||||
private readonly ElasticsearchClient _client;
|
||||
|
||||
public ElasticsearchHealthCheck(ElasticsearchClient client) => _client = client;
|
||||
|
||||
public async Task<HealthCheckResult> CheckHealthAsync(
|
||||
HealthCheckContext context, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var response = await _client.PingAsync(cancellationToken);
|
||||
|
||||
if (response.IsValidResponse)
|
||||
return HealthCheckResult.Healthy();
|
||||
|
||||
return HealthCheckResult.Unhealthy("Elasticsearch ping failed.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user