Skip to content

Commit 7f2aa7a

Browse files
Merge pull request #205 from akkadotnet/dev
v1.4.19 Release
2 parents 6e3f31c + a98dccc commit 7f2aa7a

17 files changed

+464
-106
lines changed

.github/dependabot.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: nuget
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10
8+
target-branch: dev
9+
ignore:
10+
- dependency-name: Mongo2Go
11+
versions:
12+
- 3.0.0
13+
- 3.1.0
14+
- 3.1.1
15+
- dependency-name: Akka.Persistence.TCK
16+
versions:
17+
- 1.4.17
18+
- dependency-name: akka.streams
19+
versions:
20+
- 1.4.17
21+
- dependency-name: Akka.Persistence.Query
22+
versions:
23+
- 1.4.17
24+
- dependency-name: FluentAssertions
25+
versions:
26+
- 5.10.3

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,57 @@ akka.persistence {
8787
}
8888
```
8989

90+
### Programmatic configuration
91+
92+
You can programmatically overrides the connection string setting in the HOCON configuration by adding a `MongoDbPersistenceSetup` to the
93+
`ActorSystemSetup` during `ActorSystem` creation. The `MongoDbPersistenceSetup` takes `MongoClientSettings` instances to be used to configure
94+
MongoDB client connection to the server. The `connection-string` settings in the HOCON configuration will be ignored if any of these `MongoClientSettings`
95+
exists inside the Setup object.
96+
97+
> [!NOTE]
98+
> The HOCON configuration is still needed for this to work, only the `connection-string` setting in the configuration will be overriden.
99+
100+
Setting connection override for both snapshot store and journal:
101+
```
102+
// Set snapshotClientSettings or journalClientSettings to null if you do not use them.
103+
var snapshotClientSettings = new MongoClientSettings();
104+
var journalClientSettings = new MongoClientSettings();
105+
106+
// database names are not needed when its client setting is set to null
107+
var snapshotDatabaseName = "theSnapshotDatabase"
108+
var journalDatabaseName = "theJournalDatabase"
109+
110+
var setup = BootstrapSetup.Create()
111+
.WithConfig(myHoconConfig)
112+
.And(new MongoDbPersistenceSetup(snapshotDatabaseName, snapshotClientSettings, journalDatabaseName, journalClientSettings));
113+
114+
var actorSystem = ActorSystem.Create("actorSystem", setup);
115+
```
116+
117+
Setting connection override only for snapshot store:
118+
```
119+
var snapshotClientSettings = new MongoClientSettings();
120+
var snapshotDatabaseName = "theSnapshotDatabase"
121+
122+
var setup = BootstrapSetup.Create()
123+
.WithConfig(myHoconConfig)
124+
.And(new MongoDbPersistenceSetup(snapshotDatabaseName, snapshotClientSettings, null, null));
125+
126+
var actorSystem = ActorSystem.Create("actorSystem", setup);
127+
```
128+
129+
Setting connection override only for journal:
130+
```
131+
var journalClientSettings = new MongoClientSettings();
132+
var journalDatabaseName = "theJournalDatabase"
133+
134+
var setup = BootstrapSetup.Create()
135+
.WithConfig(myHoconConfig)
136+
.And(new MongoDbPersistenceSetup(null, null, journalDatabaseName, journalClientSettings));
137+
138+
var actorSystem = ActorSystem.Create("actorSystem", setup);
139+
```
140+
90141
### Serialization
91142
[Going from v1.4.0 onwards, all events and snapshots are saved as byte arrays using the standard Akka.Persistence format](https://github.com/akkadotnet/Akka.Persistence.MongoDB/issues/72).
92143

RELEASE_NOTES.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
#### 1.4.17 March 17 2021 ####
1+
#### 1.4.19 May 04 2021 ####
22

3-
* Bump [Akka.NET version to 1.4.17](https://github.com/akkadotnet/akka.net/releases/tag/1.4.17)
4-
* [Resolve MongoDb write atomicity issues on write by not updating metadata collection](https://github.com/akkadotnet/Akka.Persistence.MongoDB/pull/186) - this is an important change that makes all writes atomic for an individual persistentId in MongoDb. We don't update the meta-data collection on write anymore - it's only done when the most recent items in the journal are deleted, and thus we store the highest recorded sequence number in the meta-data collection during deletes. All of the Akka.Persistence.Sql plugins operate this way as well.
3+
* [Bump MongoDb.Driver to 2.12.2](https://github.com/akkadotnet/Akka.Persistence.MongoDB/pull/197)
4+
* [Bump Akka.NET version to 1.4.19](https://github.com/akkadotnet/akka.net/releases/tag/1.4.19)
5+
* [Add programmatic setup support](https://github.com/akkadotnet/Akka.Persistence.MongoDB/pull/199)
6+
7+
Please [read the Akka.Persistence.MongoDb README.md on how to use the new `MongoDbPersistenceSetup` feature to programmatically configure your `MongoDbClient`](https://github.com/akkadotnet/Akka.Persistence.MongoDB#programmatic-configuration).

build-system/azure-pipeline.template.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
parameters:
22
name: ''
3+
displayName: ''
34
vmImage: ''
45
scriptFileName: ''
56
scriptArgs: 'all'
67
timeoutInMinutes: 120
78

89
jobs:
910
- job: ${{ parameters.name }}
11+
displayName: ${{ parameters.displayName }}
1012
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
1113
pool:
1214
vmImage: ${{ parameters.vmImage }}
@@ -15,6 +17,15 @@ jobs:
1517
clean: false # whether to fetch clean each time
1618
submodules: recursive # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules
1719
persistCredentials: true
20+
- task: UseDotNet@2
21+
displayName: 'Use .NET 5 SDK 5.0.101'
22+
inputs:
23+
version: 5.0.101
24+
- task: UseDotNet@2
25+
displayName: 'Use .NET Core Runtime 3.1.10'
26+
inputs:
27+
packageType: runtime
28+
version: 3.1.10
1829
# Linux or macOS
1930
- task: Bash@3
2031
displayName: Linux / OSX Build

build-system/linux-pr-validation.yaml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,18 @@ pr:
1414
include: [ dev, master ] # branch names which will trigger a build
1515

1616
jobs:
17-
- template: azure-pipeline.template.yaml
18-
parameters:
19-
name: Ubuntu
20-
vmImage: 'ubuntu-16.04'
21-
scriptFileName: ./build.sh
22-
scriptArgs: all
17+
- template: azure-pipeline.template.yaml
18+
parameters:
19+
name: 'net_core_tests_linux'
20+
displayName: '.NET Core Unit Tests (Linux)'
21+
vmImage: 'ubuntu-18.04'
22+
scriptFileName: ./build.sh
23+
scriptArgs: runTestsNetCore
24+
25+
- template: azure-pipeline.template.yaml
26+
parameters:
27+
name: 'net_5_tests_linux'
28+
displayName: '.NET 5 Unit Tests (Linux)'
29+
vmImage: 'ubuntu-18.04'
30+
scriptFileName: ./build.sh
31+
scriptArgs: runTestsNet

build-system/windows-pr-validation.yaml

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,36 @@ pr:
1414
name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)
1515

1616
jobs:
17-
- template: azure-pipeline.template.yaml
18-
parameters:
19-
name: Windows
20-
vmImage: 'vs2017-win2016'
21-
scriptFileName: build.cmd
22-
scriptArgs: all
17+
- template: azure-pipeline.template.yaml
18+
parameters:
19+
name: 'netfx_tests_windows'
20+
displayName: '.NET Framework Unit Tests (Windows)'
21+
vmImage: 'windows-2019'
22+
scriptFileName: build.cmd
23+
scriptArgs: runTests
24+
25+
- template: azure-pipeline.template.yaml
26+
parameters:
27+
name: 'net_core_tests_windows'
28+
displayName: '.NET Core Unit Tests (Windows)'
29+
vmImage: 'windows-2019'
30+
scriptFileName: build.cmd
31+
scriptArgs: runTestsNetCore
32+
33+
- template: azure-pipeline.template.yaml
34+
parameters:
35+
name: 'net_5_tests_windows'
36+
displayName: '.NET 5 Unit Tests (Windows)'
37+
vmImage: 'windows-2019'
38+
scriptFileName: build.cmd
39+
scriptArgs: runTestsNet
40+
41+
- template: azure-pipeline.template.yaml
42+
parameters:
43+
name: 'nuget_pack'
44+
displayName: 'NuGet Pack'
45+
vmImage: 'windows-2019'
46+
scriptFileName: build.cmd
47+
scriptArgs: CreateNuget nugetprerelease=dev
48+
outputDirectory: 'bin/nuget'
49+
artifactName: 'nuget_pack-$(Build.BuildId)'

build.fsx

Lines changed: 102 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,16 @@ let toolsDir = __SOURCE_DIRECTORY__ @@ "tools"
4343
let output = __SOURCE_DIRECTORY__ @@ "bin"
4444
let outputTests = __SOURCE_DIRECTORY__ @@ "TestResults"
4545
let outputPerfTests = __SOURCE_DIRECTORY__ @@ "PerfResults"
46+
let outputBinaries = output @@ "binaries"
4647
let outputNuGet = output @@ "nuget"
48+
let outputBinariesNet45 = outputBinaries @@ "net45"
49+
let outputBinariesNetStandard = outputBinaries @@ "netstandard2.0"
50+
let outputBinariesNet = outputBinaries @@ "net5.0"
51+
52+
// Configuration values for tests
53+
let testNetFrameworkVersion = "net471"
54+
let testNetCoreVersion = "netcoreapp3.1"
55+
let testNetVersion = "net5.0"
4756

4857
Target "Clean" (fun _ ->
4958
ActivateFinalTarget "KillCreatedProcesses"
@@ -52,7 +61,13 @@ Target "Clean" (fun _ ->
5261
CleanDir outputTests
5362
CleanDir outputPerfTests
5463
CleanDir outputNuGet
64+
CleanDir outputBinariesNet45
65+
CleanDir outputBinariesNetStandard
66+
CleanDir outputBinariesNet
5567
CleanDir "docs/_site"
68+
69+
CleanDirs !! "./**/bin"
70+
CleanDirs !! "./**/obj"
5671
)
5772

5873
Target "AssemblyInfo" (fun _ ->
@@ -61,17 +76,35 @@ Target "AssemblyInfo" (fun _ ->
6176
)
6277

6378
Target "Build" (fun _ ->
79+
let additionalArgs = if versionSuffix.Length > 0 then [sprintf "/p:VersionSuffix=%s" versionSuffix] else []
6480
DotNetCli.Build
6581
(fun p ->
6682
{ p with
6783
Project = solutionFile
68-
Configuration = configuration }) // "Rebuild"
84+
Configuration = configuration
85+
AdditionalArgs = additionalArgs }) // "Rebuild"
6986
)
7087

7188

7289
//--------------------------------------------------------------------------------
7390
// Tests targets
7491
//--------------------------------------------------------------------------------
92+
type Runtime =
93+
| NetCore
94+
| Net
95+
| NetFramework
96+
97+
let getTestAssembly runtime project =
98+
let assemblyPath = match runtime with
99+
| NetCore -> !! ("src" @@ "**" @@ "bin" @@ "Release" @@ testNetCoreVersion @@ fileNameWithoutExt project + ".dll")
100+
| NetFramework -> !! ("src" @@ "**" @@ "bin" @@ "Release" @@ testNetFrameworkVersion @@ fileNameWithoutExt project + ".dll")
101+
| Net -> !! ("src" @@ "**" @@ "bin" @@ "Release" @@ testNetVersion @@ fileNameWithoutExt project + ".dll")
102+
103+
if Seq.isEmpty assemblyPath then
104+
None
105+
else
106+
Some (assemblyPath |> Seq.head)
107+
75108
module internal ResultHandling =
76109
let (|OK|Failure|) = function
77110
| 0 -> OK
@@ -99,8 +132,56 @@ Target "RunTests" (fun _ ->
99132
let runSingleProject project =
100133
let arguments =
101134
match (hasTeamCity) with
102-
| true -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --results-directory %s -- -parallel none -teamcity" (outputTests))
103-
| false -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --results-directory %s -- -parallel none" (outputTests))
135+
| true -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory %s -- -parallel none -teamcity" testNetFrameworkVersion outputTests)
136+
| false -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory %s -- -parallel none" testNetFrameworkVersion outputTests)
137+
138+
let result = ExecProcess(fun info ->
139+
info.FileName <- "dotnet"
140+
info.WorkingDirectory <- (Directory.GetParent project).FullName
141+
info.Arguments <- arguments) (TimeSpan.FromMinutes 30.0)
142+
143+
ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.Error result
144+
145+
CreateDir outputTests
146+
projects |> Seq.iter (log)
147+
projects |> Seq.iter (runSingleProject)
148+
)
149+
150+
Target "RunTestsNetCore" (fun _ ->
151+
let projects =
152+
match (isWindows) with
153+
| true -> !! "./src/**/*.Tests.csproj"
154+
| _ -> !! "./src/**/*.Tests.csproj" // if you need to filter specs for Linux vs. Windows, do it here
155+
156+
let runSingleProject project =
157+
let arguments =
158+
match (hasTeamCity) with
159+
| true -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory %s -- -parallel none -teamcity" testNetCoreVersion outputTests)
160+
| false -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory %s -- -parallel none" testNetCoreVersion outputTests)
161+
162+
let result = ExecProcess(fun info ->
163+
info.FileName <- "dotnet"
164+
info.WorkingDirectory <- (Directory.GetParent project).FullName
165+
info.Arguments <- arguments) (TimeSpan.FromMinutes 30.0)
166+
167+
ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.Error result
168+
169+
CreateDir outputTests
170+
projects |> Seq.iter (log)
171+
projects |> Seq.iter (runSingleProject)
172+
)
173+
174+
Target "RunTestsNet" (fun _ ->
175+
let projects =
176+
match (isWindows) with
177+
| true -> !! "./src/**/*.Tests.csproj"
178+
| _ -> !! "./src/**/*.Tests.csproj" // if you need to filter specs for Linux vs. Windows, do it here
179+
180+
let runSingleProject project =
181+
let arguments =
182+
match (hasTeamCity) with
183+
| true -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory %s -- -parallel none -teamcity" testNetVersion outputTests)
184+
| false -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory %s -- -parallel none" testNetVersion outputTests)
104185

105186
let result = ExecProcess(fun info ->
106187
info.FileName <- "dotnet"
@@ -109,6 +190,7 @@ Target "RunTests" (fun _ ->
109190

110191
ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.Error result
111192

193+
CreateDir outputTests
112194
projects |> Seq.iter (log)
113195
projects |> Seq.iter (runSingleProject)
114196
)
@@ -275,15 +357,17 @@ Target "Help" <| fun _ ->
275357
"./build.ps1 [target]"
276358
""
277359
" Targets for building:"
278-
" * Build Builds"
279-
" * Nuget Create and optionally publish nugets packages"
280-
" * SignPackages Signs all NuGet packages, provided that the following arguments are passed into the script: SignClientSecret={secret} and SignClientUser={username}"
281-
" * RunTests Runs tests"
282-
" * All Builds, run tests, creates and optionally publish nuget packages"
283-
" * DocFx Creates a DocFx-based website for this solution"
360+
" * Build Builds"
361+
" * Nuget Create and optionally publish nugets packages"
362+
" * SignPackages Signs all NuGet packages, provided that the following arguments are passed into the script: SignClientSecret={secret} and SignClientUser={username}"
363+
" * RunTests Runs Net Framework tests"
364+
" * RunTestsNetCore Runs Net Core tests"
365+
" * RunTestsNet Runs Net 5 tests"
366+
" * All Builds, run tests, creates and optionally publish nuget packages"
367+
" * DocFx Creates a DocFx-based website for this solution"
284368
""
285369
" Other Targets"
286-
" * Help Display this help"
370+
" * Help Display this help"
287371
""]
288372

289373
//--------------------------------------------------------------------------------
@@ -293,15 +377,20 @@ Target "Help" <| fun _ ->
293377
Target "BuildRelease" DoNothing
294378
Target "All" DoNothing
295379
Target "Nuget" DoNothing
380+
Target "RunTestsFull" DoNothing
381+
Target "RunTestsNetCoreFull" DoNothing
296382

297383
// build dependencies
298384
"Clean" ==> "AssemblyInfo" ==> "Build" ==> "BuildRelease"
299385

300386
// tests dependencies
301387
"Build" ==> "RunTests"
388+
"Build" ==> "RunTestsNetCore"
389+
"Build" ==> "RunTestsNet"
390+
"Build" ==> "NBench"
302391

303392
// nuget dependencies
304-
"Clean" ==> "Build" ==> "CreateNuget"
393+
"Clean" ==> "BuildRelease" ==> "CreateNuget"
305394
"CreateNuget" ==> "SignPackages" ==> "PublishNuget" ==> "Nuget"
306395

307396
// docs
@@ -310,6 +399,8 @@ Target "Nuget" DoNothing
310399
// all
311400
"BuildRelease" ==> "All"
312401
"RunTests" ==> "All"
402+
"RunTestsNetCore" ==> "All"
403+
"RunTestsNet" ==> "All"
313404
"NBench" ==> "All"
314405
"Nuget" ==> "All"
315406

0 commit comments

Comments
 (0)