Skip to content

Commit

Permalink
Dynamo Outbox constructur fixes (#2342)
Browse files Browse the repository at this point in the history
* Added constructor without AWSCredentials and RegionEndpoint as it's not being used, maintaining backwards compatibility.

* Add Obsolete annotation to properties and constructor

* Update sample
  • Loading branch information
Thijmen authored Oct 25, 2022
1 parent 0c5cf47 commit 5e5aa60
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion samples/WebAPI_Dynamo/GreetingsWeb/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private IAmazonDynamoDB CreateAndRegisterLocalClient(IServiceCollection services
var dynamoDb = new AmazonDynamoDBClient(credentials, clientConfig);
services.Add(new ServiceDescriptor(typeof(IAmazonDynamoDB), dynamoDb));

var dynamoDbConfiguration = new DynamoDbConfiguration(credentials, RegionEndpoint.EUWest1);
var dynamoDbConfiguration = new DynamoDbConfiguration();
services.Add(new ServiceDescriptor(typeof(DynamoDbConfiguration), dynamoDbConfiguration));

return dynamoDb;
Expand Down
20 changes: 17 additions & 3 deletions src/Paramore.Brighter.Outbox.DynamoDB/DynamoDbConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
using System;
using Amazon;
using Amazon.Runtime;

namespace Paramore.Brighter.Outbox.DynamoDB
{
public class DynamoDbConfiguration
{
//What AWS Credentials to use
{
/// <summary>
/// What AWS Credentials to use
/// </summary>
[Obsolete("This property is not being used")]
public AWSCredentials Credentials { get; }
/// <summary>
/// Which AWS region
/// </summary>
[Obsolete("This property is not being used")]
public RegionEndpoint Region { get; }
/// <summary>
/// The table that forms the Outbox
Expand All @@ -27,7 +32,8 @@ public class DynamoDbConfiguration
/// Timeout in milliseconds
/// </summary>
public int Timeout { get; }


[Obsolete("Use the DynamoDbConfiguration without AWSCredentials and without RegionEndpoint")]
public DynamoDbConfiguration(
AWSCredentials credentials,
RegionEndpoint region,
Expand All @@ -41,5 +47,13 @@ public DynamoDbConfiguration(
DeliveredIndexName = "Delivered";
Timeout = timeout;
}

public DynamoDbConfiguration(string tableName = null, int timeout = 500)
{
TableName = tableName ?? "brighter_outbox";
OutstandingIndexName = "Outstanding";
DeliveredIndexName = "Delivered";
Timeout = timeout;
}
}
}

0 comments on commit 5e5aa60

Please sign in to comment.