diff --git a/samples/dependency-injection/aspnetcore/Core_7/ASPNetCore.StartupProjects.txt b/samples/dependency-injection/aspnetcore/Core_7/ASPNetCore.StartupProjects.txt deleted file mode 100644 index 98f1490d125..00000000000 --- a/samples/dependency-injection/aspnetcore/Core_7/ASPNetCore.StartupProjects.txt +++ /dev/null @@ -1 +0,0 @@ -Sample\Sample.csproj \ No newline at end of file diff --git a/samples/dependency-injection/aspnetcore/Core_7/ASPNetCore.sln b/samples/dependency-injection/aspnetcore/Core_7/ASPNetCore.sln deleted file mode 100644 index 21696976b5e..00000000000 --- a/samples/dependency-injection/aspnetcore/Core_7/ASPNetCore.sln +++ /dev/null @@ -1,25 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29728.190 -MinimumVisualStudioVersion = 15.0.26730.12 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample", "Sample\Sample.csproj", "{6E6C9C2A-8D9B-41AF-B5E5-1AF5310686E7}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleAutofac", "SampleAutofac\SampleAutofac.csproj", "{6FA6EAAD-E749-4511-BBA9-DB5709835195}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6E6C9C2A-8D9B-41AF-B5E5-1AF5310686E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6E6C9C2A-8D9B-41AF-B5E5-1AF5310686E7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6FA6EAAD-E749-4511-BBA9-DB5709835195}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6FA6EAAD-E749-4511-BBA9-DB5709835195}.Debug|Any CPU.Build.0 = Debug|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {0D70AFFA-DAF9-43E5-AA4A-59BA214FD0A9} - EndGlobalSection -EndGlobal diff --git a/samples/dependency-injection/aspnetcore/Core_7/Sample/MyHandler.cs b/samples/dependency-injection/aspnetcore/Core_7/Sample/MyHandler.cs deleted file mode 100644 index 104f615a0ba..00000000000 --- a/samples/dependency-injection/aspnetcore/Core_7/Sample/MyHandler.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Threading.Tasks; -using NServiceBus; - -#region InjectingDependency -public class MyHandler : - IHandleMessages -{ - MyService myService; - - public MyHandler(MyService myService) - { - this.myService = myService; - } - - public Task Handle(MyMessage message, IMessageHandlerContext context) - { - myService.WriteHello(); - return Task.CompletedTask; - } -} -#endregion diff --git a/samples/dependency-injection/aspnetcore/Core_7/Sample/MyMessage.cs b/samples/dependency-injection/aspnetcore/Core_7/Sample/MyMessage.cs deleted file mode 100644 index 65952daa4c9..00000000000 --- a/samples/dependency-injection/aspnetcore/Core_7/Sample/MyMessage.cs +++ /dev/null @@ -1,6 +0,0 @@ -using NServiceBus; - -public class MyMessage : - IMessage -{ -} \ No newline at end of file diff --git a/samples/dependency-injection/aspnetcore/Core_7/Sample/MyService.cs b/samples/dependency-injection/aspnetcore/Core_7/Sample/MyService.cs deleted file mode 100644 index 07698c5aa86..00000000000 --- a/samples/dependency-injection/aspnetcore/Core_7/Sample/MyService.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Microsoft.Extensions.Logging; - -public class MyService -{ - readonly ILogger logger; - - public MyService(ILogger logger) - { - this.logger = logger; - } - - public void WriteHello() - { - logger.LogInformation("Hello from MyService."); - } -} \ No newline at end of file diff --git a/samples/dependency-injection/aspnetcore/Core_7/Sample/Program.cs b/samples/dependency-injection/aspnetcore/Core_7/Sample/Program.cs deleted file mode 100644 index f4d5581ae76..00000000000 --- a/samples/dependency-injection/aspnetcore/Core_7/Sample/Program.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using Microsoft.AspNetCore.Hosting; -using System.Threading.Tasks; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using NServiceBus; - -static class Program -{ - public static async Task Main(string[] args) - { - var host = CreateHostBuilder(args).Build(); - await host.StartAsync(); - - Console.WriteLine("Press any key to shutdown"); - Console.ReadKey(); - await host.StopAsync(); - } - - static IHostBuilder CreateHostBuilder(string[] args) => - #region ContainerConfiguration - Host.CreateDefaultBuilder(args) - .ConfigureServices(services => - { - services.AddSingleton(); - }) - .UseNServiceBus(c => - { - var endpointConfiguration = new EndpointConfiguration("Sample.Core"); - endpointConfiguration.UseTransport(); - return endpointConfiguration; - }) - .ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup()); - #endregion -} \ No newline at end of file diff --git a/samples/dependency-injection/aspnetcore/Core_7/Sample/Properties/launchSettings.json b/samples/dependency-injection/aspnetcore/Core_7/Sample/Properties/launchSettings.json deleted file mode 100644 index 9c569c1d8a3..00000000000 --- a/samples/dependency-injection/aspnetcore/Core_7/Sample/Properties/launchSettings.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:52774/", - "sslPort": 0 - } - }, - "profiles": { - "Sample.Core": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:52775/" - } - } -} \ No newline at end of file diff --git a/samples/dependency-injection/aspnetcore/Core_7/Sample/Sample.csproj b/samples/dependency-injection/aspnetcore/Core_7/Sample/Sample.csproj deleted file mode 100644 index d0750a8df29..00000000000 --- a/samples/dependency-injection/aspnetcore/Core_7/Sample/Sample.csproj +++ /dev/null @@ -1,9 +0,0 @@ - - - net9.0;net8.0;net6.0 - 10.0 - - - - - \ No newline at end of file diff --git a/samples/dependency-injection/aspnetcore/Core_7/Sample/Startup.cs b/samples/dependency-injection/aspnetcore/Core_7/Sample/Startup.cs deleted file mode 100644 index 99155914a13..00000000000 --- a/samples/dependency-injection/aspnetcore/Core_7/Sample/Startup.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Http; -using Microsoft.Extensions.DependencyInjection; -using System.Threading.Tasks; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using NServiceBus; - -public class Startup -{ - public void ConfigureServices(IServiceCollection services) - { - services.AddLogging(loggingBuilder => loggingBuilder.AddConsole()); - services.AddSingleton(); - } - - public void Configure(IApplicationBuilder applicationBuilder, IWebHostEnvironment env) - { - if (env.IsDevelopment()) - { - applicationBuilder.UseDeveloperExceptionPage(); - } - - #region RequestHandling - - applicationBuilder.Run( - handler: context => - { - if (context.Request.Path != "/") - { - // only handle requests at the root - return Task.CompletedTask; - } - var applicationServices = applicationBuilder.ApplicationServices; - var endpointInstance = applicationServices.GetService(); - var myMessage = new MyMessage(); - - return Task.WhenAll( - endpointInstance.SendLocal(myMessage), - context.Response.WriteAsync("Message sent")); - }); - - #endregion - } -} \ No newline at end of file diff --git a/samples/dependency-injection/aspnetcore/Core_7/SampleAutofac/MyHandler.cs b/samples/dependency-injection/aspnetcore/Core_7/SampleAutofac/MyHandler.cs deleted file mode 100644 index d75eb035b9c..00000000000 --- a/samples/dependency-injection/aspnetcore/Core_7/SampleAutofac/MyHandler.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Threading.Tasks; -using NServiceBus; - -public class MyHandler : - IHandleMessages -{ - MyService myService; - - public MyHandler(MyService myService) - { - this.myService = myService; - } - - public Task Handle(MyMessage message, IMessageHandlerContext context) - { - myService.WriteHello(); - return Task.CompletedTask; - } -} diff --git a/samples/dependency-injection/aspnetcore/Core_7/SampleAutofac/MyMessage.cs b/samples/dependency-injection/aspnetcore/Core_7/SampleAutofac/MyMessage.cs deleted file mode 100644 index 65952daa4c9..00000000000 --- a/samples/dependency-injection/aspnetcore/Core_7/SampleAutofac/MyMessage.cs +++ /dev/null @@ -1,6 +0,0 @@ -using NServiceBus; - -public class MyMessage : - IMessage -{ -} \ No newline at end of file diff --git a/samples/dependency-injection/aspnetcore/Core_7/SampleAutofac/MyService.cs b/samples/dependency-injection/aspnetcore/Core_7/SampleAutofac/MyService.cs deleted file mode 100644 index 07698c5aa86..00000000000 --- a/samples/dependency-injection/aspnetcore/Core_7/SampleAutofac/MyService.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Microsoft.Extensions.Logging; - -public class MyService -{ - readonly ILogger logger; - - public MyService(ILogger logger) - { - this.logger = logger; - } - - public void WriteHello() - { - logger.LogInformation("Hello from MyService."); - } -} \ No newline at end of file diff --git a/samples/dependency-injection/aspnetcore/Core_7/SampleAutofac/Program.cs b/samples/dependency-injection/aspnetcore/Core_7/SampleAutofac/Program.cs deleted file mode 100644 index c376d72a77f..00000000000 --- a/samples/dependency-injection/aspnetcore/Core_7/SampleAutofac/Program.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using Microsoft.AspNetCore.Hosting; -using System.Threading.Tasks; -using Autofac.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using NServiceBus; - -static class Program -{ - public static async Task Main(string[] args) - { - var host = CreateHostBuilder(args).Build(); - await host.StartAsync(); - - Console.WriteLine("Press any key to shutdown"); - Console.ReadKey(); - await host.StopAsync(); - } - - static IHostBuilder CreateHostBuilder(string[] args) => - #region ServiceProviderFactoryAutofac - Host.CreateDefaultBuilder(args) - .UseServiceProviderFactory(new AutofacServiceProviderFactory()) - #endregion - .UseNServiceBus(c => - { - var endpointConfiguration = new EndpointConfiguration("Sample.Core"); - endpointConfiguration.UseTransport(); - return endpointConfiguration; - }) - .ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup()); -} \ No newline at end of file diff --git a/samples/dependency-injection/aspnetcore/Core_7/SampleAutofac/Properties/launchSettings.json b/samples/dependency-injection/aspnetcore/Core_7/SampleAutofac/Properties/launchSettings.json deleted file mode 100644 index 9c569c1d8a3..00000000000 --- a/samples/dependency-injection/aspnetcore/Core_7/SampleAutofac/Properties/launchSettings.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:52774/", - "sslPort": 0 - } - }, - "profiles": { - "Sample.Core": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:52775/" - } - } -} \ No newline at end of file diff --git a/samples/dependency-injection/aspnetcore/Core_7/SampleAutofac/SampleAutofac.csproj b/samples/dependency-injection/aspnetcore/Core_7/SampleAutofac/SampleAutofac.csproj deleted file mode 100644 index 9477718ad0c..00000000000 --- a/samples/dependency-injection/aspnetcore/Core_7/SampleAutofac/SampleAutofac.csproj +++ /dev/null @@ -1,10 +0,0 @@ - - - net9.0;net8.0;net6.0 - 10.0 - - - - - - \ No newline at end of file diff --git a/samples/dependency-injection/aspnetcore/Core_7/SampleAutofac/Startup.cs b/samples/dependency-injection/aspnetcore/Core_7/SampleAutofac/Startup.cs deleted file mode 100644 index 0b043e68593..00000000000 --- a/samples/dependency-injection/aspnetcore/Core_7/SampleAutofac/Startup.cs +++ /dev/null @@ -1,50 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Http; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using NServiceBus; -using System.Threading.Tasks; -using Autofac; -using Microsoft.Extensions.Hosting; - -public class Startup -{ - #region ContainerConfigurationAutofac - public void ConfigureServices(IServiceCollection services) - { - services.AddLogging(loggingBuilder => loggingBuilder.AddConsole()); - } - - public void ConfigureContainer(ContainerBuilder containerBuilder) - { - containerBuilder.RegisterType().SingleInstance(); - } - #endregion - - public void Configure(IApplicationBuilder applicationBuilder, IWebHostEnvironment env) - { - if (env.IsDevelopment()) - { - applicationBuilder.UseDeveloperExceptionPage(); - } - - applicationBuilder.Run( - handler: context => - { - if (context.Request.Path != "/") - { - // only handle requests at the root - return Task.CompletedTask; - } - - var applicationServices = applicationBuilder.ApplicationServices; - var endpointInstance = applicationServices.GetService(); - var myMessage = new MyMessage(); - - return Task.WhenAll( - endpointInstance.SendLocal(myMessage), - context.Response.WriteAsync("Message sent")); - }); - } -} \ No newline at end of file diff --git a/samples/logging/custom-factory/Core_7/CustomFactory.sln b/samples/logging/custom-factory/Core_7/CustomFactory.sln deleted file mode 100644 index 50055481477..00000000000 --- a/samples/logging/custom-factory/Core_7/CustomFactory.sln +++ /dev/null @@ -1,19 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29728.190 -MinimumVisualStudioVersion = 15.0.26730.12 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample", "Sample\Sample.csproj", "{48F718EE-6C45-41BA-80EC-81BF34D4A623}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {48F718EE-6C45-41BA-80EC-81BF34D4A623}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {48F718EE-6C45-41BA-80EC-81BF34D4A623}.Debug|Any CPU.Build.0 = Debug|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/samples/logging/custom-factory/Core_7/Sample/ConsoleLog.cs b/samples/logging/custom-factory/Core_7/Sample/ConsoleLog.cs deleted file mode 100644 index befadfac665..00000000000 --- a/samples/logging/custom-factory/Core_7/Sample/ConsoleLog.cs +++ /dev/null @@ -1,161 +0,0 @@ -using System; -using NServiceBus.Logging; - -#region log -class ConsoleLog : - ILog -{ - string name; - public bool IsDebugEnabled { get; } - public bool IsInfoEnabled { get; } - public bool IsWarnEnabled { get; } - public bool IsErrorEnabled { get; } - public bool IsFatalEnabled { get; } - - public ConsoleLog(string name, LogLevel level) - { - this.name = name; - IsDebugEnabled = LogLevel.Debug >= level; - IsInfoEnabled = LogLevel.Info >= level; - IsWarnEnabled = LogLevel.Warn >= level; - IsErrorEnabled = LogLevel.Error >= level; - IsFatalEnabled = LogLevel.Fatal >= level; - } - - void Write(string level, string message, Exception exception) - { - Console.WriteLine($"{name}. {level}. {message}. Exception: {exception}"); - } - void Write(string level, string message) - { - Console.WriteLine($"{name}. {level}. {message}."); - } - - void Write(string level, string format, params object[] args) - { - format = $"{name}. {level}. {format}"; - Console.WriteLine(format, args); - } - - public void Debug(string message) - { - if (IsDebugEnabled) - { - Write("Debug", message); - } - } - - public void Debug(string message, Exception exception) - { - if (IsDebugEnabled) - { - Write("Debug", message, exception); - } - } - - public void DebugFormat(string format, params object[] args) - { - if (IsDebugEnabled) - { - Write("Debug", format, args); - } - } - // Other log methods excluded for brevity - #endregion - public void Info(string message) - { - if (IsInfoEnabled) - { - Write("Info", message); - } - } - - public void Info(string message, Exception exception) - { - if (IsInfoEnabled) - { - Write("Info", message, exception); - } - } - - public void InfoFormat(string format, params object[] args) - { - if (IsInfoEnabled) - { - Write("Info", format, args); - } - } - - public void Warn(string message) - { - if (IsWarnEnabled) - { - Write("Warn", message); - } - } - - public void Warn(string message, Exception exception) - { - if (IsWarnEnabled) - { - Write("Warn", message, exception); - } - } - - public void WarnFormat(string format, params object[] args) - { - if (IsWarnEnabled) - { - Write("Warn", format, args); - } - } - - public void Error(string message) - { - if (IsErrorEnabled) - { - Write("Error", message); - } - } - - public void Error(string message, Exception exception) - { - if (IsErrorEnabled) - { - Write("Error", message, exception); - } - } - - public void ErrorFormat(string format, params object[] args) - { - if (IsErrorEnabled) - { - Write("Error", format, args); - } - } - - public void Fatal(string message) - { - if (IsFatalEnabled) - { - Write("Fatal", message); - } - } - - public void Fatal(string message, Exception exception) - { - if (IsFatalEnabled) - { - Write("Fatal", message, exception); - } - } - - public void FatalFormat(string format, params object[] args) - { - if (IsFatalEnabled) - { - Write("Fatal", format, args); - } - } - -} \ No newline at end of file diff --git a/samples/logging/custom-factory/Core_7/Sample/ConsoleLoggerDefinition.cs b/samples/logging/custom-factory/Core_7/Sample/ConsoleLoggerDefinition.cs deleted file mode 100644 index d81b867746d..00000000000 --- a/samples/logging/custom-factory/Core_7/Sample/ConsoleLoggerDefinition.cs +++ /dev/null @@ -1,19 +0,0 @@ -#region definition -using NServiceBus.Logging; - -class ConsoleLoggerDefinition : - LoggingFactoryDefinition -{ - LogLevel level = LogLevel.Info; - - public void Level(LogLevel level) - { - this.level = level; - } - - protected override ILoggerFactory GetLoggingFactory() - { - return new ConsoleLoggerFactory(level); - } -} -#endregion \ No newline at end of file diff --git a/samples/logging/custom-factory/Core_7/Sample/ConsoleLoggerFactory.cs b/samples/logging/custom-factory/Core_7/Sample/ConsoleLoggerFactory.cs deleted file mode 100644 index 1f84e67075d..00000000000 --- a/samples/logging/custom-factory/Core_7/Sample/ConsoleLoggerFactory.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using NServiceBus.Logging; -#region factory - -class ConsoleLoggerFactory : - ILoggerFactory -{ - LogLevel level; - - public ConsoleLoggerFactory(LogLevel level) - { - this.level = level; - } - - public ILog GetLogger(Type type) - { - return GetLogger(type.FullName); - } - - public ILog GetLogger(string name) - { - return new ConsoleLog(name, level); - } -} - -#endregion \ No newline at end of file diff --git a/samples/logging/custom-factory/Core_7/Sample/MyHandler.cs b/samples/logging/custom-factory/Core_7/Sample/MyHandler.cs deleted file mode 100644 index 34baa0f4d9f..00000000000 --- a/samples/logging/custom-factory/Core_7/Sample/MyHandler.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Threading.Tasks; -using NServiceBus; -using NServiceBus.Logging; - -public class MyHandler : - IHandleMessages -{ - static ILog log = LogManager.GetLogger(); - - public Task Handle(MyMessage message, IMessageHandlerContext context) - { - log.Info("Hello from MyHandler"); - return Task.CompletedTask; - } -} \ No newline at end of file diff --git a/samples/logging/custom-factory/Core_7/Sample/MyMessage.cs b/samples/logging/custom-factory/Core_7/Sample/MyMessage.cs deleted file mode 100644 index 65952daa4c9..00000000000 --- a/samples/logging/custom-factory/Core_7/Sample/MyMessage.cs +++ /dev/null @@ -1,6 +0,0 @@ -using NServiceBus; - -public class MyMessage : - IMessage -{ -} \ No newline at end of file diff --git a/samples/logging/custom-factory/Core_7/Sample/Program.cs b/samples/logging/custom-factory/Core_7/Sample/Program.cs deleted file mode 100644 index 3be939ee140..00000000000 --- a/samples/logging/custom-factory/Core_7/Sample/Program.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Threading.Tasks; -using NServiceBus; -using NServiceBus.Logging; - -class Program -{ - static async Task Main() - { - Console.Title = "CustomFactory"; - #region ConfigureLogging - - var loggerDefinition = LogManager.Use(); - - // optionally set the log level in code or read from app.config - loggerDefinition.Level(LogLevel.Info); - - // logging configuration should occur prior to endpoint configuration - var endpointConfiguration = new EndpointConfiguration("Samples.Logging.CustomFactory"); - - #endregion - endpointConfiguration.UsePersistence(); - endpointConfiguration.UseTransport(); - - var endpointInstance = await Endpoint.Start(endpointConfiguration); - var myMessage = new MyMessage(); - await endpointInstance.SendLocal(myMessage); - Console.WriteLine("Press any key to exit"); - Console.ReadKey(); - await endpointInstance.Stop(); - } -} diff --git a/samples/logging/custom-factory/Core_7/Sample/Sample.csproj b/samples/logging/custom-factory/Core_7/Sample/Sample.csproj deleted file mode 100644 index 097d81446e5..00000000000 --- a/samples/logging/custom-factory/Core_7/Sample/Sample.csproj +++ /dev/null @@ -1,10 +0,0 @@ - - - net9.0;net8.0;net6.0;net48 - Exe - 10.0 - - - - - \ No newline at end of file diff --git a/samples/logging/datadog/Core_7/Datadog.sln b/samples/logging/datadog/Core_7/Datadog.sln deleted file mode 100644 index 968b60b098f..00000000000 --- a/samples/logging/datadog/Core_7/Datadog.sln +++ /dev/null @@ -1,19 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29728.190 -MinimumVisualStudioVersion = 15.0.26730.12 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Endpoint", "Endpoint\Endpoint.csproj", "{FF5BEF96-88BA-470D-975A-4EF710EE2B7A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {FF5BEF96-88BA-470D-975A-4EF710EE2B7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FF5BEF96-88BA-470D-975A-4EF710EE2B7A}.Debug|Any CPU.Build.0 = Debug|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/samples/logging/datadog/Core_7/Endpoint/DatadogFeature.cs b/samples/logging/datadog/Core_7/Endpoint/DatadogFeature.cs deleted file mode 100644 index 07b91bd4d30..00000000000 --- a/samples/logging/datadog/Core_7/Endpoint/DatadogFeature.cs +++ /dev/null @@ -1,108 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using NServiceBus; -using NServiceBus.Features; -using StatsdClient; - -class DatadogFeature : Feature -{ - MetricsOptions metricsOptions; - string endpointName; - - readonly Dictionary nameMapping = new Dictionary - { - {"# of msgs successfully processed / sec", "nservicebus.processed"}, - {"# of msgs pulled from the input queue /sec", "nservicebus.fetched"}, - {"# of msgs failures / sec", "nservicebus.failed"}, - {"Critical Time", "nservicebus.critical_time"}, - {"Processing Time", "nservicebus.processing_time"}, - {"Retries", "nservicebus.retries"}, - }; - - public DatadogFeature() - { - Defaults(settings => - { - metricsOptions = settings.EnableMetrics(); - endpointName = settings.EndpointName(); - }); - EnableByDefault(); - } - - protected override void Setup(FeatureConfigurationContext context) - { - #region setup-datadog-client - - var dogstatsdConfig = new StatsdConfig - { - StatsdServerName = "127.0.0.1", - StatsdPort = 8125 - }; //Datadog agent default address, port - - DogStatsd.Configure(dogstatsdConfig); - - #endregion - - #region datadog-enable-nsb-metrics - - metricsOptions.RegisterObservers(register: probeContext => - { - foreach (var duration in probeContext.Durations) - { - if (!nameMapping.ContainsKey(duration.Name)) - { - continue; - } - duration.Register((ref DurationEvent @event) => - { - var statName = ComposeStatName(duration.Name); - var tags = ComposeTags(@event.MessageType); - DogStatsd.Timer(statName, @event.Duration.TotalMilliseconds, tags: tags); - }); - } - - foreach (var signal in probeContext.Signals) - { - if (!nameMapping.ContainsKey(signal.Name)) - { - continue; - } - signal.Register((ref SignalEvent @event) => - { - var statName = ComposeStatName(signal.Name); - var tags = ComposeTags(@event.MessageType); - DogStatsd.Increment(statName, tags: tags); - }); - } - }); - - #endregion - } - - string ComposeStatName(string eventName) - { - nameMapping.TryGetValue(eventName, out var mappedName); - return mappedName; - } - - string[] ComposeTags(string messageType) - { - var tags = new List - { - "endpoint:" + endpointName - }; - - if (!string.IsNullOrEmpty(messageType)) - { - var fullMessageName = messageType.Split(',')[0]; - tags.Add("messagetype_fullname:" + fullMessageName); - - var shortMessageName = fullMessageName.Split('.').Last(); - tags.Add("messagetype_name:" + shortMessageName); - } - - return tags.ToArray(); - } -} diff --git a/samples/logging/datadog/Core_7/Endpoint/Endpoint.csproj b/samples/logging/datadog/Core_7/Endpoint/Endpoint.csproj deleted file mode 100644 index 0d42dbce47b..00000000000 --- a/samples/logging/datadog/Core_7/Endpoint/Endpoint.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - net9.0;net8.0;net6.0;net48 - Exe - 10.0 - - - - - - - \ No newline at end of file diff --git a/samples/logging/datadog/Core_7/Endpoint/LoadSimulator.cs b/samples/logging/datadog/Core_7/Endpoint/LoadSimulator.cs deleted file mode 100644 index 60d86fe4597..00000000000 --- a/samples/logging/datadog/Core_7/Endpoint/LoadSimulator.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using NServiceBus; - -// Simulates busy (almost no delay) / quite time in a sine wave -class LoadSimulator -{ - IEndpointInstance endpointInstance; - CancellationTokenSource tokenSource = new CancellationTokenSource(); - TimeSpan minimumDelay; - TimeSpan idleDuration; - Task fork; - - public LoadSimulator(IEndpointInstance endpointInstance, TimeSpan minimumDelay, TimeSpan idleDuration) - { - this.endpointInstance = endpointInstance; - this.minimumDelay = minimumDelay; - this.idleDuration = TimeSpan.FromTicks(idleDuration.Ticks / 2); - } - - public Task Start() - { - fork = Loop(); - return Task.CompletedTask; - } - - async Task Loop() - { - try - { - while (true) - { - await Work(); - var delay = NextDelay(); - await Task.Delay(delay, tokenSource.Token); - } - } - catch (OperationCanceledException) - { - } - } - - int index; - - TimeSpan NextDelay() - { - var angleInRadians = Math.PI / 180.0 * ++index; - var delay = TimeSpan.FromMilliseconds(idleDuration.TotalMilliseconds * Math.Sin(angleInRadians)); - delay += idleDuration; - delay += minimumDelay; - return delay; - } - - Task Work() - { - return endpointInstance.SendLocal(new SomeCommand()); - } - - public Task Stop() - { - tokenSource.Cancel(); - return fork; - } -} \ No newline at end of file diff --git a/samples/logging/datadog/Core_7/Endpoint/Program.cs b/samples/logging/datadog/Core_7/Endpoint/Program.cs deleted file mode 100644 index b237a2dcab6..00000000000 --- a/samples/logging/datadog/Core_7/Endpoint/Program.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Threading.Tasks; -using NServiceBus; - -class Program -{ - static async Task Main() - { - Console.Title = "TracingEndpoint"; - var endpointConfiguration = new EndpointConfiguration("Samples.Metrics.Tracing.Endpoint"); - endpointConfiguration.UseTransport(); - - var endpointInstance = await Endpoint.Start(endpointConfiguration); - - var simulator = new LoadSimulator(endpointInstance, TimeSpan.Zero, TimeSpan.FromSeconds(10)); - await simulator.Start(); - - try - { - Console.WriteLine("Endpoint started. Press 'enter' to send a message"); - Console.WriteLine("Press ESC key to quit"); - - while (true) - { - var key = Console.ReadKey(true); - if (key.Key == ConsoleKey.Escape) - { - break; - } - - await endpointInstance.SendLocal(new SomeCommand()); - } - } - finally - { - await simulator.Stop(); - await endpointInstance.Stop(); - } - } -} diff --git a/samples/logging/datadog/Core_7/Endpoint/SomeCommand.cs b/samples/logging/datadog/Core_7/Endpoint/SomeCommand.cs deleted file mode 100644 index a3c4171f57b..00000000000 --- a/samples/logging/datadog/Core_7/Endpoint/SomeCommand.cs +++ /dev/null @@ -1,5 +0,0 @@ -using NServiceBus; - -class SomeCommand : ICommand -{ -} \ No newline at end of file diff --git a/samples/logging/datadog/Core_7/Endpoint/SomeCommandHandler.cs b/samples/logging/datadog/Core_7/Endpoint/SomeCommandHandler.cs deleted file mode 100644 index e62fdd56bad..00000000000 --- a/samples/logging/datadog/Core_7/Endpoint/SomeCommandHandler.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Threading.Tasks; -using NServiceBus; -using NServiceBus.Logging; - -class SomeCommandHandler : IHandleMessages -{ - static ILog log = LogManager.GetLogger(); - static Random random = new Random(); - - public async Task Handle(SomeCommand message, IMessageHandlerContext context) - { - await Task.Delay(random.Next(50, 250)); - - if (random.Next(10) <= 1) - { - throw new Exception("Random 10% chaos!"); - } - - log.Info("Hello from SomeCommandHandler"); - } -} \ No newline at end of file diff --git a/samples/logging/default/Core_7/DefaultLogging.sln b/samples/logging/default/Core_7/DefaultLogging.sln deleted file mode 100644 index 50055481477..00000000000 --- a/samples/logging/default/Core_7/DefaultLogging.sln +++ /dev/null @@ -1,19 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29728.190 -MinimumVisualStudioVersion = 15.0.26730.12 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample", "Sample\Sample.csproj", "{48F718EE-6C45-41BA-80EC-81BF34D4A623}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {48F718EE-6C45-41BA-80EC-81BF34D4A623}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {48F718EE-6C45-41BA-80EC-81BF34D4A623}.Debug|Any CPU.Build.0 = Debug|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/samples/logging/default/Core_7/Sample/MyHandler.cs b/samples/logging/default/Core_7/Sample/MyHandler.cs deleted file mode 100644 index 34baa0f4d9f..00000000000 --- a/samples/logging/default/Core_7/Sample/MyHandler.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Threading.Tasks; -using NServiceBus; -using NServiceBus.Logging; - -public class MyHandler : - IHandleMessages -{ - static ILog log = LogManager.GetLogger(); - - public Task Handle(MyMessage message, IMessageHandlerContext context) - { - log.Info("Hello from MyHandler"); - return Task.CompletedTask; - } -} \ No newline at end of file diff --git a/samples/logging/default/Core_7/Sample/MyMessage.cs b/samples/logging/default/Core_7/Sample/MyMessage.cs deleted file mode 100644 index 65952daa4c9..00000000000 --- a/samples/logging/default/Core_7/Sample/MyMessage.cs +++ /dev/null @@ -1,6 +0,0 @@ -using NServiceBus; - -public class MyMessage : - IMessage -{ -} \ No newline at end of file diff --git a/samples/logging/default/Core_7/Sample/Program.cs b/samples/logging/default/Core_7/Sample/Program.cs deleted file mode 100644 index d54e5c30fe8..00000000000 --- a/samples/logging/default/Core_7/Sample/Program.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Threading.Tasks; -using NServiceBus; - -class Program -{ - static async Task Main() - { - Console.Title = "LoggingDefault"; - #region ConfigureLogging - - var defaultFactory = NServiceBus.Logging.LogManager.Use(); - - // The default logging directory is HttpContext.Current.Server.MapPath("~/App_Data/") for websites - // and AppDomain.CurrentDomain.BaseDirectory for all other processes. - defaultFactory.Directory("."); - - // Default is LogLevel.Info - defaultFactory.Level(NServiceBus.Logging.LogLevel.Debug); - - var endpointConfiguration = new EndpointConfiguration("Samples.Logging.Default"); - #endregion - endpointConfiguration.UsePersistence(); - endpointConfiguration.UseTransport(); - - var endpointInstance = await Endpoint.Start(endpointConfiguration); - var myMessage = new MyMessage(); - await endpointInstance.SendLocal(myMessage); - Console.WriteLine("Press any key to exit"); - Console.ReadKey(); - await endpointInstance.Stop(); - } -} diff --git a/samples/logging/default/Core_7/Sample/Sample.csproj b/samples/logging/default/Core_7/Sample/Sample.csproj deleted file mode 100644 index 097d81446e5..00000000000 --- a/samples/logging/default/Core_7/Sample/Sample.csproj +++ /dev/null @@ -1,10 +0,0 @@ - - - net9.0;net8.0;net6.0;net48 - Exe - 10.0 - - - - - \ No newline at end of file diff --git a/samples/logging/notifications/Core_7/Notifications.sln b/samples/logging/notifications/Core_7/Notifications.sln deleted file mode 100644 index 50055481477..00000000000 --- a/samples/logging/notifications/Core_7/Notifications.sln +++ /dev/null @@ -1,19 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29728.190 -MinimumVisualStudioVersion = 15.0.26730.12 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample", "Sample\Sample.csproj", "{48F718EE-6C45-41BA-80EC-81BF34D4A623}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {48F718EE-6C45-41BA-80EC-81BF34D4A623}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {48F718EE-6C45-41BA-80EC-81BF34D4A623}.Debug|Any CPU.Build.0 = Debug|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/samples/logging/notifications/Core_7/Sample/MyHandler.cs b/samples/logging/notifications/Core_7/Sample/MyHandler.cs deleted file mode 100644 index 14786cb7df8..00000000000 --- a/samples/logging/notifications/Core_7/Sample/MyHandler.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Threading.Tasks; -using NServiceBus; - -public class MyHandler : - IHandleMessages -{ - public Task Handle(MyMessage message, IMessageHandlerContext context) - { - throw new Exception("The exception message"); - } -} \ No newline at end of file diff --git a/samples/logging/notifications/Core_7/Sample/MyMessage.cs b/samples/logging/notifications/Core_7/Sample/MyMessage.cs deleted file mode 100644 index 3634a65b518..00000000000 --- a/samples/logging/notifications/Core_7/Sample/MyMessage.cs +++ /dev/null @@ -1,7 +0,0 @@ -using NServiceBus; - -public class MyMessage : - IMessage -{ - public string Property { get; set; } -} \ No newline at end of file diff --git a/samples/logging/notifications/Core_7/Sample/Program.cs b/samples/logging/notifications/Core_7/Sample/Program.cs deleted file mode 100644 index 0986f0312e8..00000000000 --- a/samples/logging/notifications/Core_7/Sample/Program.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using System.Threading.Tasks; -using NServiceBus; -using NServiceBus.Logging; - -class Program -{ - static async Task Main() - { - Console.Title = "Notifications"; - - #region logging - - var defaultFactory = LogManager.Use(); - defaultFactory.Level(LogLevel.Fatal); - - #endregion - - #region endpointConfig - - var endpointConfiguration = new EndpointConfiguration("Samples.Notifications"); - SubscribeToNotifications.Subscribe(endpointConfiguration); - - #endregion - - endpointConfiguration.UsePersistence(); - endpointConfiguration.UseTransport(); - - #region customDelayedRetries - - var recoverability = endpointConfiguration.Recoverability(); - recoverability.Delayed( - customizations: delayed => - { - delayed.TimeIncrease(TimeSpan.FromSeconds(1)); - }); - - #endregion - - var endpointInstance = await Endpoint.Start(endpointConfiguration); - var message = new MyMessage - { - Property = "PropertyValue" - }; - await endpointInstance.SendLocal(message); - Console.WriteLine("Press any key to exit"); - Console.ReadKey(); - await endpointInstance.Stop(); - } -} \ No newline at end of file diff --git a/samples/logging/notifications/Core_7/Sample/Sample.csproj b/samples/logging/notifications/Core_7/Sample/Sample.csproj deleted file mode 100644 index 097d81446e5..00000000000 --- a/samples/logging/notifications/Core_7/Sample/Sample.csproj +++ /dev/null @@ -1,10 +0,0 @@ - - - net9.0;net8.0;net6.0;net48 - Exe - 10.0 - - - - - \ No newline at end of file diff --git a/samples/logging/notifications/Core_7/Sample/SubscribeToNotifications.cs b/samples/logging/notifications/Core_7/Sample/SubscribeToNotifications.cs deleted file mode 100644 index b15fb2dddd9..00000000000 --- a/samples/logging/notifications/Core_7/Sample/SubscribeToNotifications.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System.Text; -using System.Threading.Tasks; -using NServiceBus; -using NServiceBus.Faults; -using NServiceBus.Logging; - - -#region subscriptions - -public static class SubscribeToNotifications -{ - static ILog log = LogManager.GetLogger(typeof(SubscribeToNotifications)); - - public static void Subscribe(EndpointConfiguration endpointConfiguration) - { - var recoverability = endpointConfiguration.Recoverability(); - recoverability.Immediate(settings => settings.OnMessageBeingRetried(Log)); - recoverability.Delayed(settings => settings.OnMessageBeingRetried(Log)); - recoverability.Failed(settings => settings.OnMessageSentToErrorQueue(Log)); - } - - static string GetMessageString(byte[] body) - { - return Encoding.UTF8.GetString(body); - } - - static Task Log(FailedMessage failed) - { - log.Fatal($@"Message sent to error queue. - Body: - {GetMessageString(failed.Body)}"); - return Task.CompletedTask; - } - - static Task Log(DelayedRetryMessage retry) - { - log.Fatal($@"Message sent to Delayed Retries. - RetryAttempt:{retry.RetryAttempt} - Body: - {GetMessageString(retry.Body)}"); - return Task.CompletedTask; - } - - static Task Log(ImmediateRetryMessage retry) - { - log.Fatal($@"Message sent to Immediate Retry. - RetryAttempt:{retry.RetryAttempt} - Body: - {GetMessageString(retry.Body)}"); - return Task.CompletedTask; - } -} - -#endregion diff --git a/samples/serializers/change-message-type/sample.md b/samples/serializers/change-message-type/sample.md index 615e8a6177e..f8fc8c2545c 100644 --- a/samples/serializers/change-message-type/sample.md +++ b/samples/serializers/change-message-type/sample.md @@ -44,7 +44,7 @@ In the Phase 2 endpoint the message type is: ## Mutation -This change is achieved via the use of a [IMutateIncomingTransportMessages](/nservicebus/pipeline/message-mutators.md?version=core_7#transport-messages-mutators-imutateincomingtransportmessages). +This change is achieved via the use of a [IMutateIncomingTransportMessages](/nservicebus/pipeline/message-mutators.md#transport-messages-mutators-imutateincomingtransportmessages). The mutator is registered at endpoint startup: