0
laura created
1 Answer(s)
-
0
- Yes. ABP doesn’t ship a RabbitMQ-specific health check out of the box, but you can add a standard ASP.NET Core health check (RabbitMQ) to your
*.HttpApi.Host(and/or any service that must connect to RabbitMQ).
- Add the RabbitMQ health check NuGet package to the host project
dotnet add package AspNetCore.HealthChecks.RabbitMQ- Register the health check in your
HttpApiHostModule
using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Modularity; public class MyProjectHttpApiHostModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { var configuration = context.Services.GetConfiguration(); context.Services .AddHealthChecks() .AddRabbitMQ( rabbitConnectionString: configuration.GetConnectionString("RabbitMQ"), name: "rabbitmq", timeout: TimeSpan.FromSeconds(5) ); } }- Expose the health endpoint in
OnApplicationInitialization
using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Volo.Abp; public override void OnApplicationInitialization(ApplicationInitializationContext context) { var app = context.GetApplicationBuilder(); app.UseConfiguredEndpoints(endpoints => { endpoints.MapHealthChecks("/health"); }); }- Configure the connection string (example)
{ "ConnectionStrings": { "RabbitMQ": "amqp://guest:guest@localhost:5672" } }Now
GET /healthwill report RabbitMQ as Healthy/Unhealthy based on connectivity.- Sources:
- https://www.nuget.org/packages/AspNetCore.HealthChecks.RabbitMQ
- https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/health-checks
- https://abp.io/community/articles/kwnjkun1
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
- Yes. ABP doesn’t ship a RabbitMQ-specific health check out of the box, but you can add a standard ASP.NET Core health check (RabbitMQ) to your