From 3f89a3a4501242959ed4f5644437c45a93ec8ec3 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Wed, 5 Oct 2022 00:18:52 +0700 Subject: [PATCH] Update RELEASE_NOTES.md for 0.5.0 release (#122) * Update RELEASE_NOTES.md for 0.5.0 release * Remove trailing whitespaces * Fix RELEASE_NOTES --- RELEASE_NOTES.md | 98 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 10ef8446..88d91ca5 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,101 @@ +## [0.5.0] / 9 October 2022 +* [Update Akka.NET from 1.4.41 to 1.4.43](https://github.com/akkadotnet/akka.net/releases/tag/1.4.43) +* [Add full options support to Akka.Persistence.SqlServer.Hosting](https://github.com/akkadotnet/Akka.Hosting/pull/107) +* [Improved Akka.Remote.Hosting implementation](https://github.com/akkadotnet/Akka.Hosting/pull/108) +* [Add a standardized option code pattern for Akka.Hosting developer](https://github.com/akkadotnet/Akka.Hosting/pull/110) +* [Add Akka.Hosting.TestKit module for unit testing projects using Akka.Hosting](https://github.com/akkadotnet/Akka.Hosting/pull/102) + +**Add full options support to Akka.Persistence.SqlServer.Hosting** + +You can now use an option class in Akka.Persistence.SqlServer.Hosting to replace HOCON configuration fully. + +**Add Akka.Hosting.TestKit module** + +The biggest difference between _Akka.Hosting.TestKit_ and _Akka.TestKit_ is that, since the test is started asynchronously, the _TestKit_ properties and methods would not be available in the unit test class constructor anymore. Since the spec depends on Microsoft `HostBuilder`, configuration has to be broken down into steps. There are overridable methods that user can use to override virtually all of the setup process. + +These are steps of what overridable methods gets called. Not all of the methods needs to be overriden, at the minimum, if you do not need a custom hosting environment, you need to override the `ConfigureAkka` method. + +1. `ConfigureLogging(ILoggingBuilder)` + + Add custom logger and filtering rules on the `HostBuilder` level. +2. `ConfigureHostConfiguration(IConfigurationBuilder)` + + Inject any additional hosting environment configuration here, such as faking environment variables, in the `HostBuilder` level. +3. `ConfigureAppConfiguration(HostBuilderContext, IConfigurationBuilder)` + + Inject the application configuration. +4. `ConfigureServices(HostBuilderContext, IServiceCollection)` + + Add additional services needed by the test, such as mocked up services used inside the dependency injection. +5. User defined HOCON configuration is injected by overriding the `Config` property, it is not passed as part of the constructor anymore. +6. `ConfigureAkka(AkkaConfigurationBuilder, IServiceProvider)` + + This is called inside `AddAkka`, use this to configure the `AkkaConfigurationBuilder` +7. `BeforeTestStart()` + + This method is called after the TestKit is initialized. Move all of the codes that used to belong in the constructor here. + +`Akka.Hosting.TestKit` extends `Akka.TestKit.TestKitBase` directly, all testing methods are available out of the box. +All of the properties, such as `Sys` and `TestActor` will be available once the unit test class is invoked. + +**Add a standardized option code pattern for Akka.Hosting developer** + +This new feature is intended for Akka.Hosting module developer only, it is used to standardize how Akka.Hosting addresses a very common HOCON configuration pattern. This allows for a HOCON-less programmatic setup replacement for the HOCON path used to configure the HOCON property. + +The pattern: + +```text +# This HOCON property references to a config block below +akka.discovery.method = akka.discovery.config + +akka.discovery.config { + class = "Akka.Discovery.Config.ConfigServiceDiscovery, Akka.Discovery" + # other options goes here +} +``` + +Example implementation: +```csharp +// The base class for the option, needs to implement the IHoconOption template interface +public abstract class DiscoveryOptionBase : IHoconOption +{ } + +// The actual option implementation +public class ConfigOption : DiscoveryOptionBase +{ + // The path value in the akka.discovery.method property above + public string ConfigPath => "akka.discovery.config"; + + // The FQCN value in the akka.discovery.config.class property above + public Type Class => typeof(ConfigServiceDiscovery); + + // Generate the same HOCON config as above + public void Apply(AkkaConfigurationBuilder builder, Setup setup = null) + { + // Modifies Akka.NET configuration either via HOCON or setup class + builder.AddHocon( + $"akka.discovery.method = {ConfigPath.ToHocon()}", + HoconAddMode.Prepend); + builder.AddHocon($"akka.discovery.config.class = { + Class.AssemblyQualifiedName.ToHocon()}", + HoconAddMode.Prepend); + + // Rest of configuration goes here + } +} + +// Akka.Hosting extension implementation +public static AkkaConfigurationBuilder WithDiscovery( + this AkkaConfigurationBuilder builder, + DiscoveryOptionBase discOption) +{ + var setup = new DiscoverySetup(); + + // gets called here + discOption.Apply(builder, setup); +} +``` + ## [0.4.3] / 9 September 2022 - [Update Akka.NET from 1.4.40 to 1.4.41](https://github.com/akkadotnet/akka.net/releases/tag/1.4.41) - [Cluster.Hosting: Add split-brain resolver support](https://github.com/akkadotnet/Akka.Hosting/pull/95)