From 0c53e605eab61a99b0f042ba84b122e733bb7a06 Mon Sep 17 00:00:00 2001 From: Thomas Hilzendegen Date: Wed, 31 Jan 2024 13:29:09 +0100 Subject: [PATCH] fix(server): use uri from factory without cluster hosts --- .../RelayServerBuilderExtensions.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Thinktecture.Relay.Server.Protocols.RabbitMq/RelayServerBuilderExtensions.cs b/src/Thinktecture.Relay.Server.Protocols.RabbitMq/RelayServerBuilderExtensions.cs index 1f5db1e17..078a91e82 100644 --- a/src/Thinktecture.Relay.Server.Protocols.RabbitMq/RelayServerBuilderExtensions.cs +++ b/src/Thinktecture.Relay.Server.Protocols.RabbitMq/RelayServerBuilderExtensions.cs @@ -66,8 +66,11 @@ public static class RelayServerBuilderExtensions Uri = new Uri(options.Value.Uri), }; - return factory.CreateConnection(AmqpTcpEndpoint.ParseMultiple(options.Value.ClusterHosts ?? factory.Uri.Host), - $"RelayServer {context.OriginId}"); + var clientName = $"RelayServer {context.OriginId}"; + + return options.Value.ClusterHosts == null + ? factory.CreateConnection(clientName) + : factory.CreateConnection(AmqpTcpEndpoint.ParseMultiple(options.Value.ClusterHosts), clientName); }); builder.Services.AddSingleton>();