From 0a7c4d8b4d14f982ccbe78239849d4d0747079ff Mon Sep 17 00:00:00 2001 From: Lutando Ngqakaza Date: Sun, 18 Aug 2019 10:04:25 +0200 Subject: [PATCH] Made some hygenic refactors for 0.5.0 --- Akkatecture.sln | 7 ++++ CHANGELOG.md | 32 +++++++++++-------- build/azure-pipelines-development-ci-cd.yaml | 10 ++++-- build/azure-pipelines-master-ci-cd.yaml | 10 ++++-- build/azure-pipelines-release-ci-cd.yaml | 4 +-- build/azure-pipelines-static-ci.yaml | 10 ++++-- .../Aggregates/AggregateManagerSettings.cs | 3 +- .../Aggregates/AggregateRootSettings.cs | 4 +-- src/Akkatecture/Jobs/Commands/Schedule.cs | 1 - src/Akkatecture/Jobs/JobSchedulerFactory.cs | 10 ------ src/Akkatecture/Jobs/JobSchedulerSettings.cs | 3 +- .../AggregateSagaManagerSettings.cs | 3 +- .../AggregateSaga/AggregateSagaSettings.cs | 3 +- .../DomainEventSubscriberSettings.cs | 3 +- 14 files changed, 64 insertions(+), 39 deletions(-) delete mode 100644 src/Akkatecture/Jobs/JobSchedulerFactory.cs diff --git a/Akkatecture.sln b/Akkatecture.sln index cd10f287..6bbaa9e5 100644 --- a/Akkatecture.sln +++ b/Akkatecture.sln @@ -57,6 +57,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{F1C674D3 build\azure-pipelines-release-ci-cd.yaml = build\azure-pipelines-release-ci-cd.yaml build\azure-pipelines-static-ci.yaml = build\azure-pipelines-static-ci.yaml build\README.md = build\README.md + build\paket.dependencies = build\paket.dependencies EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Akkatecture.TestFixture", "src\Akkatecture.TestFixture\Akkatecture.TestFixture.csproj", "{BED56747-BBF3-45F5-9EB6-C24808AA09EC}" @@ -69,6 +70,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Akkatecture.NodeTestRunner" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Akkatecture.Tests.MultiNode", "test\Akkatecture.Tests.MultiNode\Akkatecture.Tests.MultiNode.csproj", "{C7E74510-5D43-4D63-B3B1-13333DC1700E}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "templates", "templates", "{19634F28-9CC5-4B76-83B6-5AA41B3CA78E}" +ProjectSection(SolutionItems) = preProject + build\templates\fake-template.yaml = build\templates\fake-template.yaml +EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -155,6 +161,7 @@ Global {081C0036-15A6-48FE-A70E-CCC1CCA3E495} = {6F5F4612-D2DD-47E9-ADA9-18450D44E903} {216BF8B4-3A50-4EF3-BCA5-4BDA738B0B72} = {6F5F4612-D2DD-47E9-ADA9-18450D44E903} {C7E74510-5D43-4D63-B3B1-13333DC1700E} = {86C56730-ABA0-411C-898C-5966EC483594} + {19634F28-9CC5-4B76-83B6-5AA41B3CA78E} = {F1C674D3-CC23-4708-9903-7B3CD3565899} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {F5A40806-ED71-4286-A37C-BE0364FA29A6} diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b3be3a7..c98e4326 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,23 +5,27 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] + +## [0.5.0] - 2019-08-18 + ### Added -- IExecute interface as an alternative way to add command handlers to the aggregate. -- JobScheduler and JobRunner actor types for scheduling jobs. +- `IExecute` interface as an alternative way to add command handlers to the aggregate. +- `JobScheduler` and `JobRunner` actor types for scheduling persistent jobs. - receive timeouts for aggregate roots. ### Changed -- AggregateRoot and AggregateSaga logging members are using Eventsourced.Log member. +- `AggregateRoot` and `AggregateSaga` logging members are using `Eventsourced.Log` member. ## [0.4.6] - 2019-07-27 ### Added -- xUnit2 TestOutputHelper logging -- Akkatecture.Clustering Multi Node Tests -- FAKE build system -- Delete Previous Snapshot -- CHANGELOG. -- CODE_OF_CONDUCT. +- xUnit2 TestOutputHelper logging. +- Akkatecture.Clustering Multi Node Tests. +- FAKE build system. +- Delete Previous Snapshot . +- CHANGELOG.md. +- CODE_OF_CONDUCT.md. +- THIRD-PARTY-NOTICES.txt. ## [0.4.5] - 2019-05-15 @@ -29,14 +33,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Logging to use string format + params rather than interpolation. ### Fixed -- CommittedSnapshot name from ComittedSnapshot. +- `CommittedSnapshot` name from `ComittedSnapshot`. - AggregateRoot.EmitAll(...) to allow for more generic cases to be handled. ## [0.4.4] - 2019-05-09 ### Added -- DomainEventMapper that maps from journal events to. -- AggregateTestFixture support for asserting aggregate root replies. +- `DomainEventMapper` that maps from journal events to. +- `AggregateTestFixture` support for asserting aggregate root replies. ### Changed - Access levels for aggregate root properties to be more private. @@ -163,7 +167,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - MIT License. - Project logo. -[Unreleased]: https://github.com/Lutando/Akkatecture/compare/0.4.5...HEAD +[Unreleased]: https://github.com/Lutando/Akkatecture/compare/0.5.0...HEAD +[0.5.0]: https://github.com/Lutando/Akkatecture/compare/0.4.6...0.5.0 +[0.4.6]: https://github.com/Lutando/Akkatecture/compare/0.4.5...0.4.6 [0.4.5]: https://github.com/Lutando/Akkatecture/compare/0.4.4...0.4.5 [0.4.4]: https://github.com/Lutando/Akkatecture/compare/0.4.3...0.4.4 [0.4.3]: https://github.com/Lutando/Akkatecture/compare/0.4.2...0.4.3 diff --git a/build/azure-pipelines-development-ci-cd.yaml b/build/azure-pipelines-development-ci-cd.yaml index 12218a2b..4fdf3e95 100644 --- a/build/azure-pipelines-development-ci-cd.yaml +++ b/build/azure-pipelines-development-ci-cd.yaml @@ -7,14 +7,20 @@ trigger: branches: include: - dev + paths: + exclude: + - 'README.md' + - 'CODE_OF_CONDUCT.md' + - 'CHANGELOG.md' + - 'THIRD-PARTY-NOTICES.txt' pr: none variables: branch: "dev" majorVersion: '0' - minorVersion: '4' - patchVersion: '6' + minorVersion: '5' + patchVersion: '0' feedVersion: 'alpha' dayOfYear: $(DayOfYear) revCounter: $(BuildRevision) diff --git a/build/azure-pipelines-master-ci-cd.yaml b/build/azure-pipelines-master-ci-cd.yaml index 33941170..c376fcd8 100644 --- a/build/azure-pipelines-master-ci-cd.yaml +++ b/build/azure-pipelines-master-ci-cd.yaml @@ -7,14 +7,20 @@ trigger: branches: include: - master + paths: + exclude: + - 'README.md' + - 'CODE_OF_CONDUCT.md' + - 'CHANGELOG.md' + - 'THIRD-PARTY-NOTICES.txt' pr: none variables: branch: "master" majorVersion: '0' - minorVersion: '4' - patchVersion: '6' + minorVersion: '5' + patchVersion: '0' feedVersion: 'prerelease' dayOfYear: $(DayOfYear) revCounter: $(BuildRevision) diff --git a/build/azure-pipelines-release-ci-cd.yaml b/build/azure-pipelines-release-ci-cd.yaml index ea739543..df757794 100644 --- a/build/azure-pipelines-release-ci-cd.yaml +++ b/build/azure-pipelines-release-ci-cd.yaml @@ -10,8 +10,8 @@ pr: none variables: branch: "master" majorVersion: '0' - minorVersion: '4' - patchVersion: '6' + minorVersion: '5' + patchVersion: '0' feedVersion: 'nuget' name: ${{ format('{0}.{1}.{2}', variables.majorVersion, variables.minorVersion, variables.patchVersion) }} diff --git a/build/azure-pipelines-static-ci.yaml b/build/azure-pipelines-static-ci.yaml index ad95f41c..251a940f 100644 --- a/build/azure-pipelines-static-ci.yaml +++ b/build/azure-pipelines-static-ci.yaml @@ -10,12 +10,18 @@ pr: branches: include: - '*' + paths: + exclude: + - 'README.md' + - 'CODE_OF_CONDUCT.md' + - 'CHANGELOG.md' + - 'THIRD-PARTY-NOTICES.txt' variables: branch: "master" majorVersion: '0' - minorVersion: '4' - patchVersion: '6' + minorVersion: '5' + patchVersion: '0' feedVersion: 'pr' dayOfYear: $(DayOfYear) revCounter: $(BuildRevision) diff --git a/src/Akkatecture/Aggregates/AggregateManagerSettings.cs b/src/Akkatecture/Aggregates/AggregateManagerSettings.cs index 83b63f6a..21f50c4e 100644 --- a/src/Akkatecture/Aggregates/AggregateManagerSettings.cs +++ b/src/Akkatecture/Aggregates/AggregateManagerSettings.cs @@ -29,13 +29,14 @@ namespace Akkatecture.Aggregates { public class AggregateManagerSettings { + private static readonly string _section = "akkatecture.aggregate-manager"; public readonly bool HandleDeadLetters; public readonly bool AutoDispatchOnReceive; public AggregateManagerSettings(Config config) { var aggregateManagerConfig = config.WithFallback(AkkatectureDefaultSettings.DefaultConfig()); - aggregateManagerConfig = aggregateManagerConfig.GetConfig("akkatecture.aggregate-manager"); + aggregateManagerConfig = aggregateManagerConfig.GetConfig(_section); HandleDeadLetters = aggregateManagerConfig.GetBoolean("handle-deadletters"); AutoDispatchOnReceive = aggregateManagerConfig.GetBoolean("auto-dispatch-on-receive"); diff --git a/src/Akkatecture/Aggregates/AggregateRootSettings.cs b/src/Akkatecture/Aggregates/AggregateRootSettings.cs index a9ecbc45..b5a51405 100644 --- a/src/Akkatecture/Aggregates/AggregateRootSettings.cs +++ b/src/Akkatecture/Aggregates/AggregateRootSettings.cs @@ -36,8 +36,8 @@ public class AggregateRootSettings public AggregateRootSettings(Config config) { - var aggregateRootConfig = config.GetConfig(_section); - aggregateRootConfig = aggregateRootConfig ?? AkkatectureDefaultSettings.DefaultConfig().GetConfig(_section); + var aggregateRootConfig = config.WithFallback(AkkatectureDefaultSettings.DefaultConfig()); + aggregateRootConfig = aggregateRootConfig.GetConfig(_section); UseDefaultEventRecover = aggregateRootConfig.GetBoolean("use-default-event-recover"); UseDefaultSnapshotRecover = aggregateRootConfig.GetBoolean("use-default-snapshot-recover"); diff --git a/src/Akkatecture/Jobs/Commands/Schedule.cs b/src/Akkatecture/Jobs/Commands/Schedule.cs index 67812580..0a942337 100644 --- a/src/Akkatecture/Jobs/Commands/Schedule.cs +++ b/src/Akkatecture/Jobs/Commands/Schedule.cs @@ -22,7 +22,6 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. using System; -using Akka.Actor; namespace Akkatecture.Jobs.Commands { diff --git a/src/Akkatecture/Jobs/JobSchedulerFactory.cs b/src/Akkatecture/Jobs/JobSchedulerFactory.cs deleted file mode 100644 index 1bf9b11a..00000000 --- a/src/Akkatecture/Jobs/JobSchedulerFactory.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Akka.Actor; - -namespace Akkatecture.Jobs -{ - public class JobSchedulerFactory - where TJob : IJob - where TIdentity : IJobId - { - } -} \ No newline at end of file diff --git a/src/Akkatecture/Jobs/JobSchedulerSettings.cs b/src/Akkatecture/Jobs/JobSchedulerSettings.cs index 87b00963..4cf1b4bb 100644 --- a/src/Akkatecture/Jobs/JobSchedulerSettings.cs +++ b/src/Akkatecture/Jobs/JobSchedulerSettings.cs @@ -29,6 +29,7 @@ namespace Akkatecture.Jobs { public class JobSchedulerSettings { + private static string _section = "akkatecture.job-scheduler"; public string JournalPluginId { get; } public string SnapshotPluginId { get; } public TimeSpan TickInterval { get; } @@ -36,8 +37,8 @@ public class JobSchedulerSettings public JobSchedulerSettings(Config config) { var schedulerConfig = config.WithFallback(AkkatectureDefaultSettings.DefaultConfig()); + schedulerConfig = schedulerConfig.GetConfig(_section); - schedulerConfig = schedulerConfig.GetConfig("akkatecture.job-scheduler"); JournalPluginId = schedulerConfig.GetString("journal-plugin-id"); SnapshotPluginId = schedulerConfig.GetString("snapshot-plugin-id"); TickInterval = schedulerConfig.GetTimeSpan("tick-interval"); diff --git a/src/Akkatecture/Sagas/AggregateSaga/AggregateSagaManagerSettings.cs b/src/Akkatecture/Sagas/AggregateSaga/AggregateSagaManagerSettings.cs index ac219954..43e3809f 100644 --- a/src/Akkatecture/Sagas/AggregateSaga/AggregateSagaManagerSettings.cs +++ b/src/Akkatecture/Sagas/AggregateSaga/AggregateSagaManagerSettings.cs @@ -28,12 +28,13 @@ namespace Akkatecture.Sagas.AggregateSaga { public class AggregateSagaManagerSettings { + private static readonly string _section = "akkatecture.aggregate-saga-manager"; public readonly bool AutoSubscribe; public readonly bool AutoSpawnOnReceive; public AggregateSagaManagerSettings(Config config) { var aggregateSagaManagerConfig = config.WithFallback(AkkatectureDefaultSettings.DefaultConfig()); - aggregateSagaManagerConfig = aggregateSagaManagerConfig.GetConfig("akkatecture.aggregate-saga-manager"); + aggregateSagaManagerConfig = aggregateSagaManagerConfig.GetConfig(_section); AutoSpawnOnReceive = aggregateSagaManagerConfig.GetBoolean("auto-spawn-on-receive"); AutoSubscribe = aggregateSagaManagerConfig.GetBoolean("auto-subscribe"); diff --git a/src/Akkatecture/Sagas/AggregateSaga/AggregateSagaSettings.cs b/src/Akkatecture/Sagas/AggregateSaga/AggregateSagaSettings.cs index 822d0390..144995c3 100644 --- a/src/Akkatecture/Sagas/AggregateSaga/AggregateSagaSettings.cs +++ b/src/Akkatecture/Sagas/AggregateSaga/AggregateSagaSettings.cs @@ -28,13 +28,14 @@ namespace Akkatecture.Sagas.AggregateSaga { public class AggregateSagaSettings { + private static string _section = "akkatecture.aggregate-saga"; public readonly bool AutoReceive; public readonly bool UseDefaultEventRecover; public readonly bool UseDefaultSnapshotRecover; public AggregateSagaSettings(Config config) { var aggregateSagaConfig = config.WithFallback(AkkatectureDefaultSettings.DefaultConfig()); - aggregateSagaConfig = aggregateSagaConfig.GetConfig("akkatecture.aggregate-saga"); + aggregateSagaConfig = aggregateSagaConfig.GetConfig(_section); AutoReceive = aggregateSagaConfig.GetBoolean("auto-receive"); UseDefaultEventRecover = aggregateSagaConfig.GetBoolean("use-default-event-recover"); diff --git a/src/Akkatecture/Subscribers/DomainEventSubscriberSettings.cs b/src/Akkatecture/Subscribers/DomainEventSubscriberSettings.cs index 46643d5a..477310ee 100644 --- a/src/Akkatecture/Subscribers/DomainEventSubscriberSettings.cs +++ b/src/Akkatecture/Subscribers/DomainEventSubscriberSettings.cs @@ -28,13 +28,14 @@ namespace Akkatecture.Subscribers { public class DomainEventSubscriberSettings { + private static readonly string _section = "akkatecture.domain-event-subscriber"; public readonly bool AutoSubscribe; public readonly bool AutoReceive; public DomainEventSubscriberSettings(Config config) { var domainEventSubscriberConfig = config.WithFallback(AkkatectureDefaultSettings.DefaultConfig()); - domainEventSubscriberConfig = domainEventSubscriberConfig.GetConfig("akkatecture.domain-event-subscriber"); + domainEventSubscriberConfig = domainEventSubscriberConfig.GetConfig(_section); AutoSubscribe = domainEventSubscriberConfig.GetBoolean("auto-subscribe"); AutoReceive = domainEventSubscriberConfig.GetBoolean("auto-receive");