You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The RabbitMQ health check provides a way to monitor the health of your RabbitMQ message bus connection and channel.
3
+
The RabbitMQ health check provides a way to monitor the health of your RabbitMQ message bus connection and channel, especially useful with the enhanced connection resilience features.
4
+
5
+
## Architecture
6
+
7
+
The RabbitMQ message bus now uses a modular architecture with clear separation of concerns:
8
+
9
+
-**`RabbitMqMessageBus`**: Main message bus implementation that handles message production and consumption
10
+
-**`RabbitMqChannelManager`**: Dedicated connection and channel management with automatic recovery (implements `IRabbitMqChannel`)
11
+
-**`RabbitMqHealthCheck`**: Health monitoring for connection status (depends on `IRabbitMqChannel`)
12
+
13
+
This separation improves maintainability, testability, and allows for better error handling and recovery mechanisms. The health check now depends on the `IRabbitMqChannel` interface instead of the concrete `RabbitMqMessageBus` class, providing better decoupling.
4
14
5
15
## Features
6
16
7
17
- Checks if the RabbitMQ channel is available and open
8
18
- Provides detailed diagnostics information
9
19
- Integrates with ASP.NET Core Health Checks
10
20
- Returns appropriate health status based on connection state
21
+
- Works with the enhanced connection retry mechanism
22
+
- Uses `IRabbitMqChannel` interface for better separation of concerns
23
+
24
+
## Connection Resilience
25
+
26
+
The `RabbitMqChannelManager` provides enhanced connection resilience:
27
+
28
+
-**Continuous Retry**: Unlike the previous 3-attempt limit, the connection now retries indefinitely in the background
29
+
-**Automatic Recovery**: Integrates with RabbitMQ's built-in automatic recovery features
30
+
-**Connection Monitoring**: Monitors connection shutdown events and triggers reconnection
31
+
-**Health Integration**: The health check provides visibility into connection retry status
32
+
-**Thread-Safe Operations**: All channel operations are properly synchronized
Copy file name to clipboardExpand all lines: src/SlimMessageBus.Host.RabbitMQ/HealthChecks/RabbitMqHealthCheckExtensions.cs
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -33,18 +33,18 @@ public static IHealthChecksBuilder AddRabbitMq(
33
33
}
34
34
35
35
/// <summary>
36
-
/// Adds a health check for a specific RabbitMQ message bus instance.
36
+
/// Adds a health check for a specific RabbitMQ channel instance.
37
37
/// </summary>
38
38
/// <param name="builder">The health checks builder.</param>
39
-
/// <param name="messageBusFactory">A factory function to resolve the specific RabbitMQ message bus instance.</param>
39
+
/// <param name="channelFactory">A factory function to resolve the specific RabbitMQ channel instance.</param>
40
40
/// <param name="name">The health check name. If null, "rabbitmq" will be used.</param>
41
41
/// <param name="failureStatus">The health status that should be reported when the health check fails. If null, <see cref="HealthStatus.Unhealthy"/> will be reported.</param>
42
42
/// <param name="tags">A list of tags that can be used to filter sets of health checks.</param>
43
43
/// <param name="timeout">An optional <see cref="TimeSpan"/> representing the timeout of the check.</param>
0 commit comments