Skip to content

Commit

Permalink
Downgrading healthcheck for rabbitmq.
Browse files Browse the repository at this point in the history
  • Loading branch information
renemadsen committed Dec 31, 2024
1 parent 77de195 commit 6c74525
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 35 deletions.
70 changes: 36 additions & 34 deletions eFormAPI/eFormAPI.Web/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,23 +130,24 @@ public void ConfigureServices(IServiceCollection services)
var rabbituser = dbcontext.Settings.First(x => x.Name == "rabbitMqUser").Value;
var rabbitpass = dbcontext.Settings.First(x => x.Name == "rabbitMqPassword").Value;

services.AddHealthChecks()
.AddRabbitMQ(
factory: serviceProvider =>
{
var connectionFactory = new RabbitMQ.Client.ConnectionFactory
{
HostName = rabbithost,
UserName = rabbituser,
Password = rabbitpass
};
return connectionFactory.CreateConnectionAsync();
},
name: "rabbitmq",
failureStatus: HealthStatus.Unhealthy,
tags: ["message-broker"],
timeout: TimeSpan.FromSeconds(5)
);
services.AddHealthChecks().AddRabbitMQ($"amqp://{rabbituser}:{rabbitpass}@{rabbithost}", name: "rabbitmq");
// services.AddHealthChecks()
// .AddRabbitMQ(
// factory: serviceProvider =>
// {
// var connectionFactory = new RabbitMQ.Client.ConnectionFactory
// {
// HostName = rabbithost,
// UserName = rabbituser,
// Password = rabbitpass
// };
// return connectionFactory.CreateConnectionAsync();
// },
// name: "rabbitmq",
// failureStatus: HealthStatus.Unhealthy,
// tags: ["message-broker"],
// timeout: TimeSpan.FromSeconds(5)
// );
_sdkPresent = true;
}
catch (Exception ex) {
Expand Down Expand Up @@ -183,23 +184,24 @@ public void ConfigureServices(IServiceCollection services)
var rabbituser = dbcontext.Settings.First(x => x.Name == "rabbitMqUser").Value;
var rabbitpass = dbcontext.Settings.First(x => x.Name == "rabbitMqPassword").Value;

services.AddHealthChecks()
.AddRabbitMQ(
factory: serviceProvider =>
{
var connectionFactory = new RabbitMQ.Client.ConnectionFactory
{
HostName = rabbithost,
UserName = rabbituser,
Password = rabbitpass
};
return connectionFactory.CreateConnectionAsync();
},
name: "rabbitmq",
failureStatus: HealthStatus.Unhealthy,
tags: ["message-broker"],
timeout: TimeSpan.FromSeconds(5)
);
services.AddHealthChecks().AddRabbitMQ($"amqp://{rabbituser}:{rabbitpass}@{rabbithost}", name: "rabbitmq");
// services.AddHealthChecks()
// .AddRabbitMQ(
// factory: serviceProvider =>
// {
// var connectionFactory = new RabbitMQ.Client.ConnectionFactory
// {
// HostName = rabbithost,
// UserName = rabbituser,
// Password = rabbitpass
// };
// return connectionFactory.CreateConnectionAsync();
// },
// name: "rabbitmq",
// failureStatus: HealthStatus.Unhealthy,
// tags: ["message-broker"],
// timeout: TimeSpan.FromSeconds(5)
// );
_sdkPresent = true;
}
catch (Exception ex) {
Expand Down
2 changes: 1 addition & 1 deletion eFormAPI/eFormAPI.Web/eFormAPI.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

<ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.MySql" Version="9.0.0" />
<PackageReference Include="AspNetCore.HealthChecks.Rabbitmq" Version="9.0.0" />
<PackageReference Include="AspNetCore.HealthChecks.Rabbitmq" Version="8.0.2" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="9.0.0" />
<PackageReference Include="HtmlToOpenXml.dll" Version="3.2.2" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.0" />
Expand Down

0 comments on commit 6c74525

Please sign in to comment.