From ef03c4d394b1ac30a975c4e56a90f2b638c3a27b Mon Sep 17 00:00:00 2001 From: Helen T Date: Tue, 7 Apr 2020 09:59:30 -0700 Subject: [PATCH 1/3] Add UseCustomRoutingTopology --- .../RabbitMQTransportSettingsExtensions.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/NServiceBus.Transport.RabbitMQ/Configuration/RabbitMQTransportSettingsExtensions.cs b/src/NServiceBus.Transport.RabbitMQ/Configuration/RabbitMQTransportSettingsExtensions.cs index 8ab3d33d4..85cb23784 100644 --- a/src/NServiceBus.Transport.RabbitMQ/Configuration/RabbitMQTransportSettingsExtensions.cs +++ b/src/NServiceBus.Transport.RabbitMQ/Configuration/RabbitMQTransportSettingsExtensions.cs @@ -16,6 +16,18 @@ public static partial class RabbitMQTransportSettingsExtensions /// /// /// The function used to create the routing topology instance. The parameter of the function indicates whether exchanges and queues declared by the routing topology should be durable. + public static TransportExtensions UseCustomRoutingTopology(this TransportExtensions transportExtensions, Func topologyFactory) + { + transportExtensions.GetSettings().Set(topologyFactory); + return transportExtensions; + } + + /// + /// Registers a custom routing topology. + /// + /// + /// The function used to create the routing topology instance. The parameter of the function indicates whether exchanges and queues declared by the routing topology should be durable. + [ObsoleteEx(RemoveInVersion = "7.0", TreatAsErrorFromVersion = "6.0", ReplacementTypeOrMember = "RabbitMQTransportSettingsExtensions.UseCustomRoutingTopology(TransportExtensions transportExtensions, Func)")] public static TransportExtensions UseRoutingTopology(this TransportExtensions transportExtensions, Func topologyFactory) { transportExtensions.GetSettings().Set(topologyFactory); @@ -27,7 +39,7 @@ public static TransportExtensions UseRoutingTopology(this Tra /// /// public static TransportExtensions UseConventionalRoutingTopology(this TransportExtensions transportExtensions) => - transportExtensions.UseRoutingTopology(durable => new ConventionalRoutingTopology(durable)); + transportExtensions.UseCustomRoutingTopology(durable => new ConventionalRoutingTopology(durable)); /// /// Uses the direct routing topology with the specified conventions. @@ -47,7 +59,7 @@ public static TransportExtensions UseDirectRoutingTopology(th exchangeNameConvention = () => "amq.topic"; } - transportExtensions.UseRoutingTopology(durable => new DirectRoutingTopology(new DirectRoutingTopology.Conventions(exchangeNameConvention, routingKeyConvention), durable)); + transportExtensions.UseCustomRoutingTopology(durable => new DirectRoutingTopology(new DirectRoutingTopology.Conventions(exchangeNameConvention, routingKeyConvention), durable)); return transportExtensions; } From 0129377f55300120a0017b1fba26d9761d936c88 Mon Sep 17 00:00:00 2001 From: Helen T Date: Tue, 7 Apr 2020 11:19:30 -0700 Subject: [PATCH 2/3] Approve API Change --- .../ApprovalFiles/APIApprovals.Approve.approved.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/NServiceBus.Transport.RabbitMQ.Tests/ApprovalFiles/APIApprovals.Approve.approved.txt b/src/NServiceBus.Transport.RabbitMQ.Tests/ApprovalFiles/APIApprovals.Approve.approved.txt index b8ba1eba0..0a8dad8fc 100644 --- a/src/NServiceBus.Transport.RabbitMQ.Tests/ApprovalFiles/APIApprovals.Approve.approved.txt +++ b/src/NServiceBus.Transport.RabbitMQ.Tests/ApprovalFiles/APIApprovals.Approve.approved.txt @@ -1,4 +1,4 @@ -[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute(@"NServiceBus.Transport.RabbitMQ.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100dde965e6172e019ac82c2639ffe494dd2e7dd16347c34762a05732b492e110f2e4e2e1b5ef2d85c848ccfb671ee20a47c8d1376276708dc30a90ff1121b647ba3b7259a6bc383b2034938ef0e275b58b920375ac605076178123693c6c4f1331661a62eba28c249386855637780e3ff5f23a6d854700eaa6803ef48907513b92")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute(@"NServiceBus.Transport.RabbitMQ.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100dde965e6172e019ac82c2639ffe494dd2e7dd16347c34762a05732b492e110f2e4e2e1b5ef2d85c848ccfb671ee20a47c8d1376276708dc30a90ff1121b647ba3b7259a6bc383b2034938ef0e275b58b920375ac605076178123693c6c4f1331661a62eba28c249386855637780e3ff5f23a6d854700eaa6803ef48907513b92")] [assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)] namespace NServiceBus { @@ -18,10 +18,15 @@ namespace NServiceBus public static NServiceBus.TransportExtensions SetClientCertificates(this NServiceBus.TransportExtensions transportExtensions, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates) { } public static NServiceBus.TransportExtensions TimeToWaitBeforeTriggeringCircuitBreaker(this NServiceBus.TransportExtensions transportExtensions, System.TimeSpan waitTime) { } public static NServiceBus.TransportExtensions UseConventionalRoutingTopology(this NServiceBus.TransportExtensions transportExtensions) { } + public static NServiceBus.TransportExtensions UseCustomRoutingTopology(this NServiceBus.TransportExtensions transportExtensions, System.Func topologyFactory) { } public static NServiceBus.TransportExtensions UseDirectRoutingTopology(this NServiceBus.TransportExtensions transportExtensions, System.Func routingKeyConvention = null, System.Func exchangeNameConvention = null) { } public static NServiceBus.TransportExtensions UseDurableExchangesAndQueues(this NServiceBus.TransportExtensions transportExtensions, bool useDurableExchangesAndQueues) { } public static NServiceBus.TransportExtensions UseExternalAuthMechanism(this NServiceBus.TransportExtensions transportExtensions) { } public static NServiceBus.TransportExtensions UsePublisherConfirms(this NServiceBus.TransportExtensions transportExtensions, bool usePublisherConfirms) { } + [System.ObsoleteAttribute("Use `RabbitMQTransportSettingsExtensions.UseCustomRoutingTopology(TransportExtens" + + "ions transportExtensions, Func)` inst" + + "ead. Will be treated as an error from version 6.0.0. Will be removed in version " + + "7.0.0.", false)] public static NServiceBus.TransportExtensions UseRoutingTopology(this NServiceBus.TransportExtensions transportExtensions, System.Func topologyFactory) { } [System.ObsoleteAttribute("Use `RabbitMQTransportSettingsExtensions.UseRoutingTopology(TransportExtensions transportExtensions, Func)` instead. T" + From 2ed342bdccad78fece544505ba401df6dafac8a4 Mon Sep 17 00:00:00 2001 From: Helen T Date: Tue, 7 Apr 2020 11:33:17 -0700 Subject: [PATCH 3/3] Update old UseRoutingTopology obsolete message --- .../ApprovalFiles/APIApprovals.Approve.approved.txt | 8 ++++---- src/NServiceBus.Transport.RabbitMQ/obsoletes.cs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/NServiceBus.Transport.RabbitMQ.Tests/ApprovalFiles/APIApprovals.Approve.approved.txt b/src/NServiceBus.Transport.RabbitMQ.Tests/ApprovalFiles/APIApprovals.Approve.approved.txt index 0a8dad8fc..d1e62bddb 100644 --- a/src/NServiceBus.Transport.RabbitMQ.Tests/ApprovalFiles/APIApprovals.Approve.approved.txt +++ b/src/NServiceBus.Transport.RabbitMQ.Tests/ApprovalFiles/APIApprovals.Approve.approved.txt @@ -28,10 +28,10 @@ namespace NServiceBus "ead. Will be treated as an error from version 6.0.0. Will be removed in version " + "7.0.0.", false)] public static NServiceBus.TransportExtensions UseRoutingTopology(this NServiceBus.TransportExtensions transportExtensions, System.Func topologyFactory) { } - [System.ObsoleteAttribute("Use `RabbitMQTransportSettingsExtensions.UseRoutingTopology(TransportExtensions transportExtensions, Func)` instead. T" + - "he member currently throws a NotImplementedException. Will be removed in version" + - " 6.0.0.", true)] + [System.ObsoleteAttribute("Use `RabbitMQTransportSettingsExtensions.UseCustomRoutingTopology(TransportExtens" + + "ions transportExtensions, Func)` inst" + + "ead. The member currently throws a NotImplementedException. Will be removed in v" + + "ersion 6.0.0.", true)] public static NServiceBus.TransportExtensions UseRoutingTopology(this NServiceBus.TransportExtensions transportExtensions) where T : NServiceBus.Transport.RabbitMQ.IRoutingTopology, new () { } } diff --git a/src/NServiceBus.Transport.RabbitMQ/obsoletes.cs b/src/NServiceBus.Transport.RabbitMQ/obsoletes.cs index 9cacd9ebb..25136348f 100644 --- a/src/NServiceBus.Transport.RabbitMQ/obsoletes.cs +++ b/src/NServiceBus.Transport.RabbitMQ/obsoletes.cs @@ -7,7 +7,7 @@ namespace NServiceBus public static partial class RabbitMQTransportSettingsExtensions { - [ObsoleteEx(RemoveInVersion = "6.0", TreatAsErrorFromVersion = "5.0", ReplacementTypeOrMember = "RabbitMQTransportSettingsExtensions.UseRoutingTopology(TransportExtensions transportExtensions, Func)")] + [ObsoleteEx(RemoveInVersion = "6.0", TreatAsErrorFromVersion = "5.0", ReplacementTypeOrMember = "RabbitMQTransportSettingsExtensions.UseCustomRoutingTopology(TransportExtensions transportExtensions, Func)")] public static TransportExtensions UseRoutingTopology(this TransportExtensions transportExtensions) where T : IRoutingTopology, new() { throw new NotImplementedException();