back pending rabbitmq messages in postgres to allow for persistent retrying#73
Open
baseballlover723 wants to merge 2 commits intomainfrom
Open
back pending rabbitmq messages in postgres to allow for persistent retrying#73baseballlover723 wants to merge 2 commits intomainfrom
baseballlover723 wants to merge 2 commits intomainfrom
Conversation
05310eb to
e6bbbdf
Compare
e6bbbdf to
24ca987
Compare
bdc2397 to
310ac13
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The core issue with this, is that before, if rabbitmq went down, and then you restarted the modbot feeds container, then it would simply drop any messages it didn't get to sent to rabbitmq.
Now it will store them in postgres instead of memory.
I'm not 100% satisfied with this implementation. It's still pretty fundamentally dependent on using exceptions to blow up, and reconnect to everything as it's recovery method. This means that it'll continue to stop processing db stuff while rabbitmq is down. Which means that if it's down for too long, data will be pushed out of the feed and won't get added to the db at all. Which I don't like.
Tbh, part of me is wondering why I even went for RabbitMQ instead of message queuing through Postgres. But that's already done and this really doesn't need to be so robust.
I think the ideal implementation has RabbitMQ fully facaded and we like keep track of if we know it's up or down. And when we know it's down, we like retry the pending messages before sending off any new messages (so that order is maintained). Tbh, order should not be precisely guaranteed when processing messages, so tbh, even like flushing any pending messages after a success (resulting in 1 potentially very out of order message) I think is as robust as is reasonable.
Idk if I'll actually do that though. I probably shouldn't. We should just not let the rabbitmq container go down for extended periods of time.