-
Notifications
You must be signed in to change notification settings - Fork 256
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
[Bug]Archiver throws exceptions when used with a Dynamo DB outbox #3108
Comments
@dhickie I'll take a look |
@iancooper I could take a look at this if you're busy elsewhere? I'd just need a bit of context around the intent behind requiring a single topic name when fetching the list of dispatched messages, and whether we could just fetch the list of dispatched messages for all topics instead. |
Happy of you want to pick this up @dhickie I can't recall the reasoning for the archiver needing to work by topic. We may be using topic for the outbox to batch up read and produce operations. I am looking at that batching (a little by accident from the OTel work) and writing an ADR about changes we might want. |
It looks like this is something specific to the Dynamo DB outbox implementation. I can see why it's there - the GSI for dispatched messages uses the topic name as the hash key and the dispatch date as the range key. That means that when it's fetching a list of messages which can be archived, it can do a The important thing here is that key expressions are evaluated server side, so only the data fulfilling the expression is sent over the wire. This, of course, requires that you know the topic name in the first place. As the topic name is the hash key, without this information you would need to do a There are nonetheless a number of issues with the current Dynamo outbox implementation:
My proposal would be as follows: In v10
This isn't the cleanest of solutions, but it's the best I can think of that:
In v9
I'm keen to get your thoughts @iancooper @preardon, this isn't as straightforward a problem as I'd originally hoped thanks to the quirks of Dynamo DB but is an urgent issue for us as it prevents us from adopting Brighter for our outbox implementation. |
Ah yes, I think I wrote that. Old programmer you is like a different person sometimes. Thanks for digging |
The plan sounds reasonable. Interestingly in V10 we have surfaced RequestContext on most calls, we could actually pass that information there and drop args . I didn't do that because I would have to rewrite the dynamo usage, but if we are rewriting that anyway we could. The RequestContext has a bag. We could add an explicit property although we don't ask you to provide a RequestContext, you just can, so we can't rely on it being there and I worry a little that folks might set a Topic even if they did not need to i.e. using DynamoDb. Maybe creating an explicit DynamoDbOutbox record type that includes Topic and then adding that into the bag under a well-known key is one workaround to the optionality issues here? |
I assume we iterate to fill the batch, if the batch is larger than a page of results; we only pause iterating if we have reached the batch size? What happens if the batch is smaller than a page? In that case we would be iterating over the page, and not across pages? |
|
BTW @dhickie the archiver was written recently, so the DynamoDB outbox was tested against outbox/sweeper but probably not against archive when that came out. It suggests a gap somewhere in our approach. But that is why you are hitting issues with it. We used to treat archiving as an "out of band" issue for a user to resolve themselves |
@dhickie sorry for the slow reply, sound reasonable |
That's an interesting one. I can't actually find any instances of a topic being provided in
Yep that's what I had in mind.
The API for a Query operation supports an optional
I was thinking indefinitely - if another request comes in for page 1 for a given topic then that would overwrite anything that was already in the dictionary, so the maximum number of keys in the dictionary would be the number of different topics a given process publishes to. I'll make a start on a first draft PR. I'm on holiday next week so it probably won't be ready until the week after. |
I've never really seen args used for anything (that being said I mainly spend time on the Microsoft stacks) |
While working on this, I've uncovered a further issue with the outbox sweeper when used with a Dynamo DB outbox. When setting up a timed outbox sweeper hosted service, one has to provide a There is configuration on each individual Looking at the Dynamo outbox implementation, it has the same issues here as with querying for dispatched messages - you have to provide a topic name and the batch size is ignored. While I'm in this bit of the code I'll do some updates for the
|
FYI In V10 this gets used to allow us to pass the Publication through the message mapper pipeline. It will end up being used by our default message mapper, so that you can pick up the topic that the message is being sent to and set it on the header. It is also likely to be used by our OTel support. So it is becoming more important as we have a producer registered against a given topic now and you can look it up. |
I can't recall why I ignored the batch size. So give it a shot and we can see what the effects are. |
I would need to check but I believe I fixed this in V10 as it was a known limitation in V9 (due to not wanting to break interfaces) |
Describe the bug
The outbox Archiver uses the
DispatchedMessagesAsync
method to get a list of messages which have successfully been dispatched and are safe to archive. There are two methods, one of which immediately throws aNotImplementedException
in v9.8.0. This is the method that's used by the outbox archiver.In the latest v10 code, this function has an implementation, but passes
null
as the value to theargs
parameter to the overloaded version. This would result in an immediateArgumentException
.To Reproduce
Attempt to use an OutboxArchiver with a DynamoDB outbox.
Exceptions (if any)
NotImplementedException
andArgumentException
Further technical details
The text was updated successfully, but these errors were encountered: