From 9aaf18dc4652be1e0c0cebc2b560a4e5e66dd7d3 Mon Sep 17 00:00:00 2001 From: Paul Graham Date: Tue, 25 Feb 2020 13:35:02 +0000 Subject: [PATCH] added NSB 16.x to only V2 code --- .../NServiceBus/ServiceCollectionExtensions.cs | 8 +++++--- .../NServiceBus/ServiceCollectionExtensions.cs | 8 +++++--- .../Program.cs | 8 +++++--- .../NServiceBus/ServiceCollectionExtensions.cs | 7 +++++-- .../SFA.DAS.CommitmentsV2.TestSubscriber.csproj | 2 +- .../Configuration/NServiceBusConfiguration.cs | 2 +- .../SFA.DAS.CommitmentsV2/SFA.DAS.CommitmentsV2.csproj | 2 +- 7 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/CommitmentsV2/SFA.DAS.CommitmentsV2.Api/NServiceBus/ServiceCollectionExtensions.cs b/src/CommitmentsV2/SFA.DAS.CommitmentsV2.Api/NServiceBus/ServiceCollectionExtensions.cs index dac577245d..c15bfb0308 100644 --- a/src/CommitmentsV2/SFA.DAS.CommitmentsV2.Api/NServiceBus/ServiceCollectionExtensions.cs +++ b/src/CommitmentsV2/SFA.DAS.CommitmentsV2.Api/NServiceBus/ServiceCollectionExtensions.cs @@ -18,6 +18,8 @@ namespace SFA.DAS.CommitmentsV2.Api.NServiceBus { public static class ServiceCollectionExtensions { + private const string EndpointName = "SFA.DAS.CommitmentsV2.Api"; + public static IServiceCollection AddNServiceBus(this IServiceCollection services) { return services @@ -28,8 +30,8 @@ public static IServiceCollection AddNServiceBus(this IServiceCollection services var configuration = p.GetService().NServiceBusConfiguration; var runInDevelopmentMode = hostingEnvironment.IsDevelopment() || hostingEnvironment.EnvironmentName == Domain.Constants.IntegrationTestEnvironment; - var endpointConfiguration = new EndpointConfiguration("SFA.DAS.CommitmentsV2.Api") - .UseErrorQueue() + var endpointConfiguration = new EndpointConfiguration(EndpointName) + .UseErrorQueue($"{EndpointName}-errors") .UseInstallers() .UseLicense(configuration.NServiceBusLicense) .UseMessageConventions() @@ -46,7 +48,7 @@ public static IServiceCollection AddNServiceBus(this IServiceCollection services } else { - endpointConfiguration.UseAzureServiceBusTransport(configuration.ServiceBusConnectionString, s => s.AddRouting()); + endpointConfiguration.UseAzureServiceBusTransport(configuration.SharedServiceBusEndpointUrl, s => s.AddRouting()); } var endpoint = Endpoint.Start(endpointConfiguration).GetAwaiter().GetResult(); diff --git a/src/CommitmentsV2/SFA.DAS.CommitmentsV2.Jobs/NServiceBus/ServiceCollectionExtensions.cs b/src/CommitmentsV2/SFA.DAS.CommitmentsV2.Jobs/NServiceBus/ServiceCollectionExtensions.cs index cbffaf9ad0..cad448590a 100644 --- a/src/CommitmentsV2/SFA.DAS.CommitmentsV2.Jobs/NServiceBus/ServiceCollectionExtensions.cs +++ b/src/CommitmentsV2/SFA.DAS.CommitmentsV2.Jobs/NServiceBus/ServiceCollectionExtensions.cs @@ -17,6 +17,8 @@ namespace SFA.DAS.CommitmentsV2.Jobs.NServiceBus { public static class ServiceCollectionExtensions { + private const string EndpointName = "SFA.DAS.CommitmentsV2.Jobs"; + public static IServiceCollection AddNServiceBus(this IServiceCollection services) { return services @@ -27,8 +29,8 @@ public static IServiceCollection AddNServiceBus(this IServiceCollection services var configuration = p.GetService().NServiceBusConfiguration; var isDevelopment = hostingEnvironment.IsDevelopment(); - var endpointConfiguration = new EndpointConfiguration("SFA.DAS.CommitmentsV2.Jobs") - .UseErrorQueue() + var endpointConfiguration = new EndpointConfiguration(EndpointName) + .UseErrorQueue($"{EndpointName}-errors") .UseInstallers() .UseLicense(configuration.NServiceBusLicense) .UseMessageConventions() @@ -44,7 +46,7 @@ public static IServiceCollection AddNServiceBus(this IServiceCollection services } else { - endpointConfiguration.UseAzureServiceBusTransport(configuration.ServiceBusConnectionString,s => s.AddRouting()); + endpointConfiguration.UseAzureServiceBusTransport(configuration.SharedServiceBusEndpointUrl, s => s.AddRouting()); } var endpoint = Endpoint.Start(endpointConfiguration).GetAwaiter().GetResult(); diff --git a/src/CommitmentsV2/SFA.DAS.CommitmentsV2.MessageHandlers.TestHarness/Program.cs b/src/CommitmentsV2/SFA.DAS.CommitmentsV2.MessageHandlers.TestHarness/Program.cs index 9e20a77992..5dc844dc5f 100644 --- a/src/CommitmentsV2/SFA.DAS.CommitmentsV2.MessageHandlers.TestHarness/Program.cs +++ b/src/CommitmentsV2/SFA.DAS.CommitmentsV2.MessageHandlers.TestHarness/Program.cs @@ -17,6 +17,8 @@ namespace SFA.DAS.CommitmentsV2.MessageHandlers.TestHarness { internal class Program { + private const string EndpointName = "SFA.DAS.CommitmentsV2.TestHarness"; + public static async Task Main() { var builder = new ConfigurationBuilder() @@ -31,8 +33,8 @@ public static async Task Main() var config = provider.GetService>().Value.NServiceBusConfiguration; var isDevelopment = Environment.GetEnvironmentVariable(EnvironmentVariableNames.EnvironmentName) == "LOCAL"; - var endpointConfiguration = new EndpointConfiguration("SFA.DAS.CommitmentsV2.MessageHandlers.TestHarness") - .UseErrorQueue() + var endpointConfiguration = new EndpointConfiguration(EndpointName) + .UseErrorQueue($"{EndpointName}-errors") .UseInstallers() .UseMessageConventions() .UseNewtonsoftJsonSerializer(); @@ -43,7 +45,7 @@ public static async Task Main() } else { - endpointConfiguration.UseAzureServiceBusTransport(config.ServiceBusConnectionString, s => s.AddRouting()); + endpointConfiguration.UseAzureServiceBusTransport(config.SharedServiceBusEndpointUrl, s => s.AddRouting()); } var endpoint = await Endpoint.Start(endpointConfiguration); diff --git a/src/CommitmentsV2/SFA.DAS.CommitmentsV2.MessageHandlers/NServiceBus/ServiceCollectionExtensions.cs b/src/CommitmentsV2/SFA.DAS.CommitmentsV2.MessageHandlers/NServiceBus/ServiceCollectionExtensions.cs index 12327da364..0e1a8013d4 100644 --- a/src/CommitmentsV2/SFA.DAS.CommitmentsV2.MessageHandlers/NServiceBus/ServiceCollectionExtensions.cs +++ b/src/CommitmentsV2/SFA.DAS.CommitmentsV2.MessageHandlers/NServiceBus/ServiceCollectionExtensions.cs @@ -18,6 +18,8 @@ namespace SFA.DAS.CommitmentsV2.MessageHandlers.NServiceBus { public static class ServiceCollectionExtensions { + private const string EndpointName = "SFA.DAS.CommitmentsV2.MessageHandlers"; + public static IServiceCollection AddNServiceBus(this IServiceCollection services) { return services @@ -28,7 +30,8 @@ public static IServiceCollection AddNServiceBus(this IServiceCollection services var configuration = p.GetService().NServiceBusConfiguration; var isDevelopment = hostingEnvironment.IsDevelopment(); - var endpointConfiguration = new EndpointConfiguration("SFA.DAS.CommitmentsV2.MessageHandlers") + var endpointConfiguration = new EndpointConfiguration(EndpointName) + .UseErrorQueue($"{EndpointName}-errors") .UseInstallers() .UseLicense(configuration.NServiceBusLicense) .UseMessageConventions() @@ -45,7 +48,7 @@ public static IServiceCollection AddNServiceBus(this IServiceCollection services } else { - endpointConfiguration.UseAzureServiceBusTransport(configuration.ServiceBusConnectionString,s => s.AddRouting()); + endpointConfiguration.UseAzureServiceBusTransport(configuration.SharedServiceBusEndpointUrl,s => s.AddRouting()); } var endpoint = Endpoint.Start(endpointConfiguration).GetAwaiter().GetResult(); diff --git a/src/CommitmentsV2/SFA.DAS.CommitmentsV2.TestSubscriber/SFA.DAS.CommitmentsV2.TestSubscriber.csproj b/src/CommitmentsV2/SFA.DAS.CommitmentsV2.TestSubscriber/SFA.DAS.CommitmentsV2.TestSubscriber.csproj index ea9a60f9ae..1fd20e55b3 100644 --- a/src/CommitmentsV2/SFA.DAS.CommitmentsV2.TestSubscriber/SFA.DAS.CommitmentsV2.TestSubscriber.csproj +++ b/src/CommitmentsV2/SFA.DAS.CommitmentsV2.TestSubscriber/SFA.DAS.CommitmentsV2.TestSubscriber.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Configuration/NServiceBusConfiguration.cs b/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Configuration/NServiceBusConfiguration.cs index b57b64c88c..0edea4d7d3 100644 --- a/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Configuration/NServiceBusConfiguration.cs +++ b/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Configuration/NServiceBusConfiguration.cs @@ -3,7 +3,7 @@ public class NServiceBusConfiguration { public string ServiceBusConnectionString { get; set; } - + public string SharedServiceBusEndpointUrl { get; set; } public string NServiceBusLicense { get => _decodedNServiceBusLicense ?? diff --git a/src/CommitmentsV2/SFA.DAS.CommitmentsV2/SFA.DAS.CommitmentsV2.csproj b/src/CommitmentsV2/SFA.DAS.CommitmentsV2/SFA.DAS.CommitmentsV2.csproj index 54f8de3f18..592148b48f 100644 --- a/src/CommitmentsV2/SFA.DAS.CommitmentsV2/SFA.DAS.CommitmentsV2.csproj +++ b/src/CommitmentsV2/SFA.DAS.CommitmentsV2/SFA.DAS.CommitmentsV2.csproj @@ -27,7 +27,7 @@ - +