Add support for RabbitMQ cluster.

pull/7897/head
GameBelial 5 years ago
parent 020bffaa90
commit 1debba1829

@ -26,10 +26,13 @@ namespace Volo.Abp.RabbitMQ
return Connections.GetOrAdd(
connectionName,
() => Options
.Connections
.GetOrDefault(connectionName)
.CreateConnection()
() =>
{
var connection = Options.Connections.GetOrDefault(connectionName);
var hostnames = connection.HostName.TrimEnd(';').Split(';');
// Handle Rabbit MQ Cluster.
return hostnames.Length == 1 ? connection.CreateConnection() : connection.CreateConnection(hostnames);
}
);
}

Loading…
Cancel
Save