Introduce paging to Dynamo DB outbox methods & fix runtime exceptions#3180
Conversation
iancooper
left a comment
There was a problem hiding this comment.
A few housekeeping notes around licenses and namespaces, which we should probably document somewhere; a possible option on FakeTimeProvider, but...
... those are niggles and this looks great
| @@ -0,0 +1,18 @@ | |||
| using System.Collections.Generic; | |||
There was a problem hiding this comment.
Can you add the MIT License in a region; you should be able to find this in another file. You can use your own name in the copyright information?
| @@ -0,0 +1,23 @@ | |||
| using System.Collections.Generic; | |||
There was a problem hiding this comment.
Can you add the MIT License in a region; you should be able to find this in another file. You can use your own name in the copyright information?
| @@ -0,0 +1,14 @@ | |||
| namespace Paramore.Brighter.Outbox.DynamoDB | |||
There was a problem hiding this comment.
Can you add the MIT License in a region; you should be able to find this in another file. You can use your own name in the copyright information?
| @@ -0,0 +1,20 @@ | |||
| using System.Collections.Generic; | |||
There was a problem hiding this comment.
Can you add the MIT License in a region; you should be able to find this in another file. You can use your own name in the copyright information?
| @@ -0,0 +1,18 @@ | |||
| using System.Collections.Generic; | |||
|
|
|||
| namespace Paramore.Brighter.Outbox.DynamoDB | |||
There was a problem hiding this comment.
It's alright to use a file scoped namespace.
| @@ -0,0 +1,30 @@ | |||
| using System.Collections.Generic; | |||
|
|
|||
| namespace Paramore.Brighter.Outbox.DynamoDB | |||
There was a problem hiding this comment.
It's alright to use a file-scoped namespace
| @@ -0,0 +1,16 @@ | |||
| namespace Paramore.Brighter.Outbox.DynamoDB | |||
There was a problem hiding this comment.
Can you add the MIT License in a region; you should be able to find this in another file. You can use your own name in the copyright information?
| @@ -0,0 +1,284 @@ | |||
| using System; | |||
There was a problem hiding this comment.
Just FYI, we DON'T tend to put the license in test files
| private readonly DynamoDBOperationConfig _dynamoOverwriteTableConfig; | ||
| private readonly Random _random = new Random(); | ||
|
|
||
| // Stores context of the current progress of any paged queries for outstanding or dispatched messages to particular topics |
There was a problem hiding this comment.
We only tend to document the public interface of a public class, unless it is non-obvious; tl-dr avoid comments on details
There was a problem hiding this comment.
Yeah I'm forever trying to decide whether something would or wouldn't be obvious to another developer coming into the codebase. In these instances I thought it would be helpful as Dynamo's paging mechanism (and hence the need for these variables) can be confusing, and it may not be clear why there's a ConcurrentDictionary being used to store what is only ever used as a list. I'm happy to remove the comments if you think that isn't warranted though?
There was a problem hiding this comment.
I'd comment more on the why in the code, over the state of the object.
| await _dynamoDbOutbox.AddAsync(_message, context); | ||
| await _dynamoDbOutbox.MarkDispatchedAsync(_message.Id, context); | ||
|
|
||
| await Task.Delay(1000); |
There was a problem hiding this comment.
It's possible we could use FakeTimeProvider to advance a time/date since marked as dispatched and allow us to avoid having to delay here
|
@iancooper The latest set of changes should address your comments. |
|
@dhickie Looks good, do you want to merge? |
|
@iancooper Yep, happy for this to be merged. I've just merged in the latest from master. |
…BrighterCommand#3180) * Start of dynamo outbox dispatch query rework * Continuation of dynamo outbox dispatch query rework * Begin adding paging to outstanding messages query * Finish adding support for querying outstanding messages from all topics * Update outstanding message tests * Add tests for dispatched messages * Remove unused code and fix issue with misinterpreted paging tokens * Review comments
This PR fixes #3108 using the approach agreed in the issue. This has the effect of:
OutstandingMessagesandDispatchedMessagesmethods in theDynamoDbOutbox