Add deployment
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using RabbitMQ.Client;
|
||||
|
||||
public static class RabbitMqConnectionFactory
|
||||
{
|
||||
public static ConnectionFactory Create(RabbitMqOptions o, bool dispatchConsumersAsync = false)
|
||||
{
|
||||
var factory = new ConnectionFactory
|
||||
{
|
||||
HostName = o.Host,
|
||||
Port = o.Port,
|
||||
UserName = o.Username,
|
||||
Password = o.Password,
|
||||
DispatchConsumersAsync = dispatchConsumersAsync,
|
||||
};
|
||||
|
||||
if (o.UseSsl)
|
||||
{
|
||||
factory.Ssl = new SslOption
|
||||
{
|
||||
Enabled = true,
|
||||
ServerName = o.Host,
|
||||
};
|
||||
}
|
||||
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
@@ -85,12 +85,6 @@ public sealed class RabbitMqTopologyProvisioner : IHostedService
|
||||
|
||||
public Task StopAsync(CancellationToken ct) => Task.CompletedTask;
|
||||
|
||||
public ConnectionFactory BuildFactory() => new()
|
||||
{
|
||||
HostName = _opts.Host,
|
||||
Port = _opts.Port,
|
||||
UserName = _opts.Username,
|
||||
Password = _opts.Password,
|
||||
DispatchConsumersAsync = true,
|
||||
};
|
||||
public ConnectionFactory BuildFactory() =>
|
||||
RabbitMqConnectionFactory.Create(_opts, dispatchConsumersAsync: true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user