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

Use the configuration with fallback for snapshot store #112

Merged
merged 3 commits into from
Jun 21, 2019
Merged
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
27 changes: 14 additions & 13 deletions src/Akka.Persistence.SqlServer/Snapshot/SqlServerSnapshotStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,22 @@ public class SqlServerSnapshotStore : SqlSnapshotStore
{
protected readonly SqlServerPersistence Extension = SqlServerPersistence.Get(Context.System);

public SqlServerSnapshotStore(Config config) : base(config)
public SqlServerSnapshotStore(Config snapshotConfig) : base(snapshotConfig)
{
var sqlConfig = config.WithFallback(Extension.DefaultSnapshotConfig);
var config = snapshotConfig.WithFallback(Extension.DefaultSnapshotConfig);
QueryExecutor = new SqlServerQueryExecutor(new QueryConfiguration(
config.GetString("schema-name"),
config.GetString("table-name"),
"PersistenceId",
"SequenceNr",
"Snapshot",
"Manifest",
"Timestamp",
"SerializerId",
sqlConfig.GetTimeSpan("connection-timeout"),
config.GetString("serializer"),
config.GetBoolean("sequential-access")),

schemaName: config.GetString("schema-name"),
snapshotTableName: config.GetString("table-name"),
persistenceIdColumnName: "PersistenceId",
sequenceNrColumnName: "SequenceNr",
payloadColumnName: "Snapshot",
manifestColumnName: "Manifest",
timestampColumnName: "Timestamp",
serializerIdColumnName: "SerializerId",
timeout: config.GetTimeSpan("connection-timeout"),
Copy link
Member

Choose a reason for hiding this comment

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

I see the real issue was this line:

snapshotTableName: config.GetString("table-name"),

Before your change, config never had the fallback itself - that was applied, immutably, afterwards. This makes sense now.

defaultSerializer: config.GetString("serializer"),
useSequentialAccess: config.GetBoolean("sequential-access")),
Context.System.Serialization);
}

Expand Down