Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Hosting Extensions for Akka.Persistence.MongoDB #331

Merged
merged 16 commits into from
Jul 17, 2023

Conversation

mhbuck
Copy link
Contributor

@mhbuck mhbuck commented Jul 2, 2023

Fixes #329

Changes

These changes add the extension methods to support wiring up Akka.Persistence.MongoDB with Akka.Hosting.

These changes are heavily influenced by the way the hosting extensions were created in the Postgres repo (https://github.com/akkadotnet/Akka.Persistence.PostgreSql/). If there are any additional test cases that could be added please let me know.

I have a different version of these changes running in an application and I have not come across any initial issues. The application does not use persistence extensively so there might be some edge cases I am not aware of that need to be handled.

Checklist

For significant changes, please ensure that the following have been completed (delete if not relevant):

<Import Project="..\common.props" />

<PropertyGroup>
<TargetFrameworks>$(NetFrameworkTestVersion);$(NetTestVersion);$(NetCoreTestVersion)</TargetFrameworks>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$(NetFrameworkTestVersion) - I did not have the Netframework developer kit installed on my machine so the tests have not been run against framework. Given the changes I don't believe it will be an issue but if required I will get them installed. They were all run against NetTestVersion and NetCoreTestVersion

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries - looks like things are passing on CI/CD so far. We can probably drop .NET Framework for testing MongoDb in the near future anyway.


namespace Akka.Persistence.MongoDb.Hosting.Tests
{
public class MongoDbJournalOptionsSpec
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests are basically clones of the ones here https://github.com/akkadotnet/Akka.Persistence.PostgreSql/blob/dev/src/Akka.Persistence.PostgreSql.Tests/Hosting/PostgreSqlOptionsSpec.cs

I have split them up and cleaned up parts but if there are additional cases needed I am happy to add them.

</PropertyGroup>

<ItemGroup>
<PackageReference Include="Akka.Persistence.Hosting" Version="$(AkkaVersion)" />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the other projects it looked like targeting $(AkkaVersion) was the correct approach.

/// </exception>
public static AkkaConfigurationBuilder WithMongoDbPersistence(
this AkkaConfigurationBuilder builder,
string connectionString,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this method I have only added the connectionString as a parameter that is custom on top of the default. For this plugin specifically are there any others that you would suggest adding?

@@ -0,0 +1,41 @@
# Akka.Persistence.MongoDb.Hosting
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some input if this is sufficient for a readme would be appreciated. Is there anything additional that would be useful to be covered.

options.Serializer.Should().Be("hyperion");

// Dispose called here as project not using latest language features.
stream.Dispose();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this to both tests as the using declarations are not currently available in the language features for this project and it caused build failures. Do you have a preferred way of handling this?

@mhbuck
Copy link
Contributor Author

mhbuck commented Jul 12, 2023

It looks like the test failures are due to timeouts. This time it was the windows build and previously it was the linux one. Is there a better way to handle the build/test runs?

Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments

<Import Project="..\common.props" />

<PropertyGroup>
<TargetFrameworks>$(NetFrameworkTestVersion);$(NetTestVersion);$(NetCoreTestVersion)</TargetFrameworks>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries - looks like things are passing on CI/CD so far. We can probably drop .NET Framework for testing MongoDb in the near future anyway.

/// <summary>
/// Transaction
/// </summary>
public bool UseWriteTransaction { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the default value for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explicit default has been set - Confirmed it matches reference conf.

/// <summary>
/// Transaction
/// </summary>
public bool UseWriteTransaction { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Copy link
Contributor Author

@mhbuck mhbuck Jul 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explicit default has been set - Confirmed it matches reference conf from snapshot-store section.

@Aaronontheweb Aaronontheweb requested a review from Arkatufus July 14, 2023 14:24
Copy link
Contributor

@Arkatufus Arkatufus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need to add Akka.Hosting support
4 participants