run test on phase 24 and 33
This commit is contained in:
@@ -24,14 +24,7 @@ public sealed class ClinicalSyncBatchConsumer : BackgroundService
|
||||
{
|
||||
await Task.Delay(TimeSpan.FromSeconds(5), stoppingToken);
|
||||
|
||||
var factory = new ConnectionFactory
|
||||
{
|
||||
HostName = _rabbitOpts.Host,
|
||||
Port = _rabbitOpts.Port,
|
||||
UserName = _rabbitOpts.Username,
|
||||
Password = _rabbitOpts.Password,
|
||||
DispatchConsumersAsync = true
|
||||
};
|
||||
var factory = RabbitMqConnectionFactory.Create(_rabbitOpts, dispatchConsumersAsync: true);
|
||||
|
||||
using var connection = factory.CreateConnection("clinical-sync-consumer");
|
||||
using var channel = connection.CreateModel();
|
||||
|
||||
+1
-8
@@ -30,14 +30,7 @@ public sealed class DischargeSummaryWorkerService : BackgroundService
|
||||
await Task.Delay(TimeSpan.FromSeconds(5), stoppingToken);
|
||||
|
||||
var o = _rabbitOpts.Value;
|
||||
var factory = new ConnectionFactory
|
||||
{
|
||||
HostName = o.Host,
|
||||
Port = o.Port,
|
||||
UserName = o.Username,
|
||||
Password = o.Password,
|
||||
DispatchConsumersAsync = true,
|
||||
};
|
||||
var factory = RabbitMqConnectionFactory.Create(o, dispatchConsumersAsync: true);
|
||||
|
||||
using var connection = factory.CreateConnection("discharge-summary-worker");
|
||||
using var channel = connection.CreateModel();
|
||||
|
||||
@@ -29,14 +29,7 @@ public sealed class EscalationWorkerService : BackgroundService
|
||||
await Task.Delay(TimeSpan.FromSeconds(5), stoppingToken);
|
||||
|
||||
var o = _opts.Value;
|
||||
var factory = new ConnectionFactory
|
||||
{
|
||||
HostName = o.Host,
|
||||
Port = o.Port,
|
||||
UserName = o.Username,
|
||||
Password = o.Password,
|
||||
DispatchConsumersAsync = true,
|
||||
};
|
||||
var factory = RabbitMqConnectionFactory.Create(o, dispatchConsumersAsync: true);
|
||||
|
||||
using var connection = factory.CreateConnection("escalation-worker");
|
||||
using var channel = connection.CreateModel();
|
||||
|
||||
+4
-10
@@ -38,8 +38,9 @@ public sealed class NotificationPublisherService : BackgroundService
|
||||
var consumerConfig = new ConsumerConfig
|
||||
{
|
||||
BootstrapServers = _kafkaOptions.BootstrapServers,
|
||||
GroupId = "notification-publisher",
|
||||
AutoOffsetReset = AutoOffsetReset.Earliest,
|
||||
GroupId = _kafkaOptions.NotificationPublisherGroupId,
|
||||
AutoOffsetReset = Enum.Parse<AutoOffsetReset>(
|
||||
_kafkaOptions.NotificationPublisherAutoOffsetReset, ignoreCase: true),
|
||||
EnableAutoCommit = false,
|
||||
};
|
||||
|
||||
@@ -163,13 +164,6 @@ public sealed class NotificationPublisherService : BackgroundService
|
||||
private IConnectionFactory BuildRabbitFactory()
|
||||
{
|
||||
var o = _rabbitOpts.Value;
|
||||
return new ConnectionFactory
|
||||
{
|
||||
HostName = o.Host,
|
||||
Port = o.Port,
|
||||
UserName = o.Username,
|
||||
Password = o.Password,
|
||||
DispatchConsumersAsync = true,
|
||||
};
|
||||
return RabbitMqConnectionFactory.Create(o, dispatchConsumersAsync: true);
|
||||
}
|
||||
}
|
||||
@@ -27,14 +27,7 @@ public sealed class PagingWorkerService : BackgroundService
|
||||
await Task.Delay(TimeSpan.FromSeconds(5), stoppingToken); // wait for topology
|
||||
|
||||
var o = _opts.Value;
|
||||
var factory = new ConnectionFactory
|
||||
{
|
||||
HostName = o.Host,
|
||||
Port = o.Port,
|
||||
UserName = o.Username,
|
||||
Password = o.Password,
|
||||
DispatchConsumersAsync = true,
|
||||
};
|
||||
var factory = RabbitMqConnectionFactory.Create(o, dispatchConsumersAsync: true);
|
||||
|
||||
using var connection = factory.CreateConnection("paging-worker");
|
||||
using var channel = connection.CreateModel();
|
||||
|
||||
@@ -45,14 +45,7 @@ public class OutboxRelayService : BackgroundService
|
||||
RetryBackoffMs = 100
|
||||
}).Build();
|
||||
|
||||
var factory = new ConnectionFactory
|
||||
{
|
||||
HostName = _rabbitOpts.Host,
|
||||
Port = _rabbitOpts.Port,
|
||||
UserName = _rabbitOpts.Username,
|
||||
Password = _rabbitOpts.Password,
|
||||
DispatchConsumersAsync = true,
|
||||
};
|
||||
var factory = RabbitMqConnectionFactory.Create(_rabbitOpts);
|
||||
_rabbitConnection = factory.CreateConnection("outbox-relay");
|
||||
_rabbitChannel = _rabbitConnection.CreateModel();
|
||||
_rabbitProps = _rabbitChannel.CreateBasicProperties();
|
||||
|
||||
@@ -23,13 +23,7 @@ public sealed class ReconciliationPublisher : IReconciliationPublisher
|
||||
|
||||
public Task PublishAsync(ReconciliationAlert alert, CancellationToken ct)
|
||||
{
|
||||
var factory = new ConnectionFactory
|
||||
{
|
||||
HostName = _opts.Host,
|
||||
Port = _opts.Port,
|
||||
UserName = _opts.Username,
|
||||
Password = _opts.Password,
|
||||
};
|
||||
var factory = RabbitMqConnectionFactory.Create(_opts);
|
||||
|
||||
using var connection = factory.CreateConnection("reconciliation-publisher");
|
||||
using var channel = connection.CreateModel();
|
||||
|
||||
@@ -9,4 +9,6 @@ public class KafkaOptions
|
||||
public int OutboxPollIntervalMs { get; set; } = 500;
|
||||
public int OutboxMaxRetries { get; set; } = 10;
|
||||
public int MaxPoisonRetries { get; set; } = 5;
|
||||
public string NotificationPublisherGroupId { get; set; } = "notification-publisher";
|
||||
public string NotificationPublisherAutoOffsetReset { get; set; } = "Earliest";
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ public sealed class RabbitMqOptions
|
||||
public int Port { get; init; } = 5674;
|
||||
public string Username { get; init; } = "guest";
|
||||
public string Password { get; init; } = "guest";
|
||||
public string VirtualHost { get; init; } = "/";
|
||||
// Drives both the paging worker poll timeout and the DLQ x-message-ttl.
|
||||
// In production: 300000 (5 min). In tests: 5000 (5 sec).
|
||||
public int PagingAckTimeoutMs { get; init; } = 300000;
|
||||
|
||||
@@ -11,13 +11,7 @@ public sealed class RabbitMqHealthCheck : IHealthCheck
|
||||
public async Task<HealthCheckResult> CheckHealthAsync(
|
||||
HealthCheckContext context, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var factory = new ConnectionFactory
|
||||
{
|
||||
HostName = _options.Host,
|
||||
Port = _options.Port,
|
||||
UserName = _options.Username,
|
||||
Password = _options.Password
|
||||
};
|
||||
var factory = RabbitMqConnectionFactory.Create(_options);
|
||||
|
||||
using var connection = await Task.Run(() => factory.CreateConnection(), cancellationToken);
|
||||
var data = new Dictionary<string, object> { ["endpoint"] = connection.Endpoint.ToString() };
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using RabbitMQ.Client;
|
||||
|
||||
public static class RabbitMqConnectionFactory
|
||||
{
|
||||
public static ConnectionFactory Create(RabbitMqOptions o, bool dispatchConsumersAsync = false) => new()
|
||||
{
|
||||
HostName = o.Host,
|
||||
Port = o.Port,
|
||||
UserName = o.Username,
|
||||
Password = o.Password,
|
||||
VirtualHost = o.VirtualHost,
|
||||
DispatchConsumersAsync = dispatchConsumersAsync,
|
||||
};
|
||||
}
|
||||
@@ -171,12 +171,6 @@ public sealed class RabbitMqTopologyProvisioner : IHostedService
|
||||
}
|
||||
}
|
||||
|
||||
public IConnectionFactory BuildFactory() => new ConnectionFactory
|
||||
{
|
||||
HostName = _opts.Host,
|
||||
Port = _opts.Port,
|
||||
UserName = _opts.Username,
|
||||
Password = _opts.Password,
|
||||
DispatchConsumersAsync = true,
|
||||
};
|
||||
public IConnectionFactory BuildFactory() =>
|
||||
RabbitMqConnectionFactory.Create(_opts, dispatchConsumersAsync: true);
|
||||
}
|
||||
@@ -11,7 +11,12 @@
|
||||
{ "Name": "Console" }
|
||||
]
|
||||
},
|
||||
"Kafka": {
|
||||
"NotificationPublisherGroupId": "notification-publisher-integration-test",
|
||||
"NotificationPublisherAutoOffsetReset": "Latest"
|
||||
},
|
||||
"RabbitMq": {
|
||||
"VirtualHost": "vigilcare_test",
|
||||
"PagingAckTimeoutMs": 5000
|
||||
},
|
||||
"DataLake": {
|
||||
|
||||
Reference in New Issue
Block a user