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

Added default table and snapshot container names #99

Merged
merged 5 commits into from
Jul 10, 2020
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
25 changes: 25 additions & 0 deletions src/Akka.Persistence.Azure.Tests/AzurePersistenceConfigSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@ public void ShouldParseDefaultSnapshotConfig()
blobSettings.RequestTimeout.Should().Be(TimeSpan.FromSeconds(3));
blobSettings.VerboseLogging.Should().BeFalse();
}

[Fact]
public void ShouldProvideDefaultContainerNameValue()
{
var blobSettings =
AzureBlobSnapshotStoreSettings.Create(
ConfigurationFactory.ParseString(@"akka.persistence.snapshot-store.azure-blob-store{
connection-string = foo
}").WithFallback(AzurePersistence.DefaultConfig)
.GetConfig("akka.persistence.snapshot-store.azure-blob-store"));

blobSettings.ContainerName.Should().Be("akka-persistence-default-container");
}

[Fact]
public void ShouldParseTableConfig()
Expand All @@ -61,6 +74,18 @@ public void ShouldParseTableConfig()
tableSettings.VerboseLogging.Should().BeFalse();
}

[Fact]
public void ShouldProvideDefaultTableNameValue()
{
var tableSettings =
AzureTableStorageJournalSettings.Create(
ConfigurationFactory.ParseString(@"akka.persistence.journal.azure-table{
connection-string = foo
}").WithFallback(AzurePersistence.DefaultConfig)
.GetConfig("akka.persistence.journal.azure-table"));
tableSettings.TableName.Should().Be("AkkaPersistenceDefaultTable");
}

[Fact]
public void ShouldParseQueryConfig()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ namespace Akka.Persistence.Azure.Journal
/// </summary>
public sealed class AzureTableStorageJournalSettings
{

private static readonly string[] ReservedTableNames = {"tables"};

public AzureTableStorageJournalSettings(
Expand Down Expand Up @@ -79,7 +78,6 @@ public static AzureTableStorageJournalSettings Create(Config config)
var connectTimeout = config.GetTimeSpan("connect-timeout", TimeSpan.FromSeconds(3));
var requestTimeout = config.GetTimeSpan("request-timeout", TimeSpan.FromSeconds(3));
var verbose = config.GetBoolean("verbose-logging", false);

return new AzureTableStorageJournalSettings(
connectionString,
tableName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,15 @@ public AzureBlobSnapshotStoreSettings(string connectionString, string containerN
public static AzureBlobSnapshotStoreSettings Create(Config config)
{
var connectionString = config.GetString("connection-string");
var containerName = config.GetString("container-name");
var connectTimeout = config.GetTimeSpan("connect-timeout", TimeSpan.FromSeconds(3));
var requestTimeout = config.GetTimeSpan("request-timeout", TimeSpan.FromSeconds(3));
var verbose = config.GetBoolean("verbose-logging", false);
return new AzureBlobSnapshotStoreSettings(connectionString, containerName, connectTimeout, requestTimeout,
var containerName = config.GetString("container-name");
return new AzureBlobSnapshotStoreSettings(
connectionString,
containerName,
connectTimeout,
requestTimeout,
verbose);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Akka.Persistence.Azure/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ akka.persistence {
connection-string = ""

# the name of the Windows Azure Table used to persist journal events
table-name = ""
table-name = "AkkaPersistenceDefaultTable"

# Initial timeout to use when connecting to Azure Storage for the first time.
connect-timeout = 3s
Expand Down Expand Up @@ -63,7 +63,7 @@ akka.persistence {
connection-string = ""

# the name of the Windows Azure Blob Store container used to persist snapshots
container-name = ""
container-name = "akka-persistence-default-container"

# Initial timeout to use when connecting to Azure Storage for the first time.
connect-timeout = 3s
Expand Down