=== Summary: 675 files | 7 generated | 484 fresh | 4605 untracked | 4268 adopted | 355 marked | 466 validated-ok | 2+0 stale (sig+body) | 0 skipped | 0 failed | elapsed 11:08:11.442 (40091.44s) ===
This commit is contained in:
@@ -13,6 +13,7 @@ namespace adas_core.Infrastructure.Services;
|
||||
/// <summary>
|
||||
/// Provides functionality for receiving and processing incoming data, messages, or requests.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=0552406 -->
|
||||
public class ReceiverService
|
||||
{
|
||||
private readonly ILogger<ReceiverService> _logger;
|
||||
@@ -83,6 +84,7 @@ public class ReceiverService
|
||||
/// <summary>
|
||||
/// Registers all application queues defined in settings, including queues for observations, treatments, patients, pumps, appointments, recordings, recording alerts, and alarm observations, by adding each one through the <c>AddQueue</c> call.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=b14e3d9 body=1372d9f -->
|
||||
private void SetQueues()
|
||||
{
|
||||
AddQueue(_settings.ObservationsQueue);
|
||||
@@ -99,6 +101,7 @@ public class ReceiverService
|
||||
/// Adds a queue to the internal collection only when the supplied value is not null, empty, or whitespace; otherwise the call is ignored.
|
||||
/// </summary>
|
||||
/// <param name="queue">The queue identifier to add to the collection. Null, empty, or whitespace values are silently skipped.</param>
|
||||
/// <!-- aidoc:v1 sig=322aa1a body=bdf4bfa -->
|
||||
private void AddQueue(string? queue)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(queue))
|
||||
@@ -108,6 +111,7 @@ public class ReceiverService
|
||||
/// <summary>
|
||||
/// Attempts to establish a connection to RabbitMQ by disposing any existing bus, configuring EasyNetQ with the configured connection string, and registering consumers for all configured queues. If the connection fails, the failure is logged and a timer is scheduled to retry the connection after a five-second delay, recursively invoking the method when the timer elapses.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=417902d body=fbb9618 -->
|
||||
private void TryToConnect()
|
||||
{
|
||||
try
|
||||
@@ -145,6 +149,7 @@ public class ReceiverService
|
||||
/// <summary>
|
||||
/// Disposes the underlying bus instance if it implements <see cref="IDisposable"/>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=21b17a7 body=232143f -->
|
||||
private void DisposeBus()
|
||||
{
|
||||
if (_bus is IDisposable disposable)
|
||||
@@ -194,6 +199,7 @@ public class ReceiverService
|
||||
/// </summary>
|
||||
/// <param name="queue">The queue name to resolve to its corresponding API request service.</param>
|
||||
/// <returns>The matching <see cref="IApiRequestService"/> instance if the queue is recognized; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=62d9eca body=23b1d5d -->
|
||||
private IApiRequestService? ResolveService(string queue)
|
||||
{
|
||||
return queue switch
|
||||
@@ -214,6 +220,7 @@ public class ReceiverService
|
||||
/// Asynchronously reprocesses messages from the specified error queue by deriving the target queue name from the routing key (with "Key" removed), resolving the associated service, and resubmitting the message. Operations are skipped when the bus is uninitialized, the derived queue name is empty, or no service is resolved.
|
||||
/// </summary>
|
||||
/// <param name="errorQueueName">The name of the error queue from which to reprocess messages.</param>
|
||||
/// <!-- aidoc:v1 sig=baa5e88 body=90bfb05 -->
|
||||
public async Task ProcessErrorQueue(string errorQueueName)
|
||||
{
|
||||
if (_bus == null)
|
||||
@@ -255,6 +262,7 @@ public class ReceiverService
|
||||
/// Sends EasyNetQ messages to a service implementing IApiRequestService
|
||||
/// Throws exception to trigger retry on failure
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=f5ba50e body=1be117a -->
|
||||
private void TryToParseAndSend(IMessage<string> msg, IApiRequestService service)
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user