Skip to content

Commit 3eb0ea1

Browse files
committed
MInor change to activate SQS health check by state
1 parent 8a09907 commit 3eb0ea1

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/KeeperData.Infrastructure/Messaging/Setup/ServiceCollectionExtensions.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ public static void AddMessagingDependencies(this IServiceCollection services, IC
2121
{
2222
var intakeEventQueueConfig = configuration.GetRequiredSection($"{nameof(QueueConsumerOptions)}:{nameof(IntakeEventQueueOptions)}");
2323
services.Configure<IntakeEventQueueOptions>(intakeEventQueueConfig);
24-
services.AddSingleton(intakeEventQueueConfig.Get<IntakeEventQueueOptions>()!);
24+
25+
var intakeEventQueueOptions = intakeEventQueueConfig.Get<IntakeEventQueueOptions>() ?? new() { QueueUrl = "Missing", Disabled = true };
26+
services.AddSingleton(intakeEventQueueOptions);
2527

2628
if (configuration["LOCALSTACK_ENDPOINT"] != null)
2729
{
@@ -48,8 +50,11 @@ public static void AddMessagingDependencies(this IServiceCollection services, IC
4850

4951
services.AddMessageHandlers();
5052

51-
services.AddHealthChecks()
52-
.AddCheck<QueueHealthCheck<IntakeEventQueueOptions>>("intake-event-consumer", tags: ["aws", "sqs"]);
53+
if (!intakeEventQueueOptions.Disabled)
54+
{
55+
services.AddHealthChecks()
56+
.AddCheck<QueueHealthCheck<IntakeEventQueueOptions>>("intake-event-consumer", tags: ["aws", "sqs"]);
57+
}
5358
}
5459

5560
private static void AddMessageConsumers(this IServiceCollection services)

0 commit comments

Comments
 (0)