Skip to content

Introduce paging to Dynamo DB outbox methods & fix runtime exceptions#3180

Merged
iancooper merged 11 commits into
BrighterCommand:masterfrom
dhickie:issues/3108
Jul 9, 2024
Merged

Introduce paging to Dynamo DB outbox methods & fix runtime exceptions#3180
iancooper merged 11 commits into
BrighterCommand:masterfrom
dhickie:issues/3108

Conversation

@dhickie

@dhickie dhickie commented Jul 2, 2024

Copy link
Copy Markdown
Contributor

This PR fixes #3108 using the approach agreed in the issue. This has the effect of:

  • Adhering to page sizes passed to the OutstandingMessages and DispatchedMessages methods in the DynamoDbOutbox
  • Supporting retrieval of outstanding or dispatched messages from the outbox for all topics, instead of one particular topic

@iancooper iancooper left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's alright to use a file scoped namespace.

@@ -0,0 +1,30 @@
using System.Collections.Generic;

namespace Paramore.Brighter.Outbox.DynamoDB

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's alright to use a file-scoped namespace

@@ -0,0 +1,16 @@
namespace Paramore.Brighter.Outbox.DynamoDB

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We only tend to document the public interface of a public class, unless it is non-obvious; tl-dr avoid comments on details

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

@dhickie

dhickie commented Jul 3, 2024

Copy link
Copy Markdown
Contributor Author

@iancooper The latest set of changes should address your comments.

@iancooper iancooper left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @dhickie it looks good.

@iancooper

Copy link
Copy Markdown
Member

@dhickie Looks good, do you want to merge?

@iancooper iancooper added 3 - Done Bug feature request v10 v9 Required for v9 release .NET Pull requests that update .net code labels Jul 5, 2024
@dhickie

dhickie commented Jul 9, 2024

Copy link
Copy Markdown
Contributor Author

@iancooper Yep, happy for this to be merged. I've just merged in the latest from master.

@iancooper iancooper merged commit d4367bc into BrighterCommand:master Jul 9, 2024
@dhickie dhickie deleted the issues/3108 branch February 27, 2025 14:54
DevJonny pushed a commit to DevJonny/Brighter that referenced this pull request Feb 28, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3 - Done Bug feature request .NET Pull requests that update .net code v9 Required for v9 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]Archiver throws exceptions when used with a Dynamo DB outbox

2 participants