Skip to content

Commit

Permalink
fix: Create Connection for rabbit health check
Browse files Browse the repository at this point in the history
  • Loading branch information
alex289 committed Jan 1, 2025
1 parent 133c868 commit 255dbb3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion CleanArchitecture.Api/Program.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using CleanArchitecture.Api.BackgroundServices;
using CleanArchitecture.Api.Extensions;
using CleanArchitecture.Application.Extensions;
Expand All @@ -15,6 +16,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using RabbitMQ.Client;

var builder = WebApplication.CreateBuilder(args);

Expand Down Expand Up @@ -46,7 +48,14 @@
.AddSqlServer(dbConnectionString!)
.AddRedis(redisConnectionString!, "Redis")
.AddRabbitMQ(
rabbitConfiguration.ConnectionString,
async _ =>
{
var factory = new ConnectionFactory
{
Uri = new Uri(rabbitConfiguration.ConnectionString),
};
return await factory.CreateConnectionAsync();
},
name: "RabbitMQ");
}

Expand Down

0 comments on commit 255dbb3

Please sign in to comment.