Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 44 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,19 @@ Both journal and snapshot store share the same configuration keys (however they
```hocon
akka.persistence {
journal {
plugin = "akka.persistence.journal.mongodb"
Copy link
Member Author

Choose a reason for hiding this comment

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

Updated README to include call-timeout settings.

plugin = "akka.persistence.journal.mongodb"
mongodb {
# qualified type name of the MongoDb persistence journal actor
class = "Akka.Persistence.MongoDb.Journal.MongoDbJournal, Akka.Persistence.MongoDb"

# connection string used for database access
connection-string = ""

# transaction
use-write-transaction = off

# should corresponding journal table's indexes be initialized automatically
auto-initialize = off
auto-initialize = on

# dispatcher used to drive journal actor
plugin-dispatcher = "akka.actor.default-dispatcher"
Expand All @@ -55,20 +58,29 @@ akka.persistence {
#
# NOTE: this will likely break features such as Akka.Cluster.Sharding, IActorRef serialization, AtLeastOnceDelivery, and more.
legacy-serialization = off

# Per-call timeout setting - Journal will err on the side of caution and fail calls that take longer than this
# to complete. This is to prevent the journal from blocking indefinitely if the database is slow or unresponsive.
# If you experience frequent failures due to timeouts, you may want to increase this value.
# Default: 10 seconds
call-timeout = 10s
}
}

snapshot-store {
plugin = "akka.persistence.snapshot-store.mongodb"
plugin = "akka.persistence.snapshot-store.mongodb"
mongodb {
# qualified type name of the MongoDB persistence snapshot actor
class = "Akka.Persistence.MongoDb.Snapshot.MongoDbSnapshotStore, Akka.Persistence.MongoDb"

# connection string used for database access
connection-string = ""

# transaction
use-write-transaction = off

# should corresponding snapshot's indexes be initialized automatically
auto-initialize = off
auto-initialize = on

# dispatcher used to drive snapshot storage actor
plugin-dispatcher = "akka.actor.default-dispatcher"
Expand All @@ -82,8 +94,36 @@ akka.persistence {
#
# NOTE: this will likely break features such as Akka.Cluster.Sharding, IActorRef serialization, AtLeastOnceDelivery, and more.
legacy-serialization = off

# Per-call timeout setting - Journal will err on the side of caution and fail calls that take longer than this
# to complete. This is to prevent the journal from blocking indefinitely if the database is slow or unresponsive.
# If you experience frequent failures due to timeouts, you may want to increase this value.
# Default: 10 seconds
call-timeout = 10s
}
}

query {
mongodb {
# Implementation class of the EventStore ReadJournalProvider
class = "Akka.Persistence.MongoDb.Query.MongoDbReadJournalProvider, Akka.Persistence.MongoDb"

# Absolute path to the write journal plugin configuration entry that this
# query journal will connect to.
# If undefined (or "") it will connect to the default journal as specified by the
# akka.persistence.journal.plugin property.
write-plugin = ""

# The SQL write journal is notifying the query side as soon as things
# are persisted, but for efficiency reasons the query side retrieves the events
# in batches that sometimes can be delayed up to the configured `refresh-interval`.
refresh-interval = 3s

# How many events to fetch in one query (replay) and keep buffered until they
# are delivered downstreams.
max-buffer-size = 500
}
}
}
```

Expand Down
3 changes: 3 additions & 0 deletions src/Akka.Persistence.MongoDb.Tests/MongoDbSettingsSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//-----------------------------------------------------------------------

using FluentAssertions;
using FluentAssertions.Extensions;
using Xunit;

namespace Akka.Persistence.MongoDb.Tests
Expand All @@ -23,6 +24,7 @@ public void Mongo_JournalSettings_must_have_default_values()
mongoPersistence.JournalSettings.Collection.Should().Be("EventJournal");
mongoPersistence.JournalSettings.MetadataCollection.Should().Be("Metadata");
mongoPersistence.JournalSettings.LegacySerialization.Should().BeFalse();
mongoPersistence.JournalSettings.CallTimeout.Should().Be(10.Seconds());
Copy link
Member Author

Choose a reason for hiding this comment

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

Validate new settings as part of our normal MongoDbSettingsSpecs.

}

[Fact]
Expand All @@ -34,6 +36,7 @@ public void Mongo_SnapshotStoreSettingsSettings_must_have_default_values()
mongoPersistence.SnapshotStoreSettings.AutoInitialize.Should().BeTrue();
mongoPersistence.SnapshotStoreSettings.Collection.Should().Be("SnapshotStore");
mongoPersistence.SnapshotStoreSettings.LegacySerialization.Should().BeFalse();
mongoPersistence.SnapshotStoreSettings.CallTimeout.Should().Be(10.Seconds());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

<PropertyGroup>
<TargetFrameworks>$(NetStandardLibVersion)</TargetFrameworks>
<LangVersion>latest</LangVersion>
Copy link
Member Author

Choose a reason for hiding this comment

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

Added this in order to support using statements, which I ended up not even needing in most cases.

</PropertyGroup>

<ItemGroup>
Expand Down
Loading