-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[PM-17562] Add support for retries on event integrations #5795
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 occa 8000 sionally send you account related emails.
Already on GitHub? Sign in to your account
[PM-17562] Add support for retries on event integrations #5795
Conversation
Great job, no security vulnerabilities found in this Pull Request |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5795 +/- ##
==========================================
- Coverage 50.83% 47.49% -3.34%
==========================================
Files 1651 1660 +9
Lines 74866 75186 +320
Branches 6741 6756 +15
==========================================
- Hits 38055 35711 -2344
- Misses 35291 38012 +2721
+ Partials 1520 1463 -57 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Little things and questions.
The one thing I have been sorta staring at:
In the RabbitMQ implementation, we are using a very simple retry queue. It has a TTL of 30 seconds with a dead-letter pointing back to its original queue. This means that messages are put in the retry queue and no handlers ever pick them up. When the TTL expires, Rabbit dead-letters them back to the main integration queue, where they are picked up and reprocessed.
Is this standard / normal setup with Rabbit? And per your other notes, we can't use the NotBeforeUtc
instead of the 30s that's hardcoded? I am trying to think about how we can compensate for some of these gaps if this is all Rabbit can do.
src/Core/AdminConsole/Models/Data/Integrations/IntegrationHandlerResult.cs
Outdated
Show resolved
Hide resolved
src/Core/AdminConsole/Models/Data/Integrations/IntegrationMessage.cs
Outdated
Show resolved
Hide resolved
src/Core/AdminConsole/Models/Data/Integrations/IntegrationMessage.cs
Outdated
Show resolved
Hide resolved
src/Core/AdminConsole/Services/Implementations/RabbitMqIntegrationListenerService.cs
Show resolved
Hide resolved
src/Core/AdminConsole/Services/Implementations/RabbitMqIntegrationListenerService.cs
Outdated
Show resolved
Hide resolved
src/Core/AdminConsole/Services/Implementations/RabbitMqIntegrationListenerService.cs
Show resolved
Hide resolved
src/Core/AdminConsole/Services/Implementations/WebhookIntegrationHandler.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there.
src/Core/AdminConsole/Services/Implementations/RabbitMqIntegrationListenerService.cs
Outdated
Show resolved
Hide resolved
src/Core/AdminConsole/Models/Data/Integrations/IntegrationHandlerResult.cs
Outdated
Show resolved
Hide resolved
src/Core/AdminConsole/Models/Data/Integrations/IntegrationMessage.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate the detailed PR description, it provided much needed context. I'm mostly just following along here and relying on @withinfocus' review for the detail. The issues below are pretty minor, happy to discuss if needed.
src/Core/AdminConsole/Models/Data/Integrations/IIntergationMessage.cs
Outdated
Show resolved
Hide resolved
src/Core/AdminConsole/Services/Implementations/EventIntegrationHandler.cs
Outdated
Show resolved
Hide resolved
src/Core/AdminConsole/Models/Data/Integrations/IntegrationHandlerResult.cs
Outdated
Show resolved
Hide resolved
src/Core/AdminConsole/Services/Implementations/WebhookIntegrationHandler.cs
Show resolved
Hide resolved
|
🎟️ Tracking
PM-17562
📔 Objective
This PR adds a new layer of AMQP messaging (for RabbitMQ now, but ASB will be added in another PR). This allows us to queue each individual integration message to allow for retries and dead-lettering.
The flow of events with this new change (assuming the feature flag is On and Rabbit is configured):
EventRepository
.IntegrationType
. For each configuration:IntegrationMessage
IntegrationType
.In the RabbitMQ implementation, we are using a very simple retry queue. It has a TTL of 30 seconds with a dead-letter pointing back to its original queue. This means that messages are put in the retry queue and no handlers ever pick them up. When the TTL expires, Rabbit dead-letters them back to the main integration queue, where they are picked up and reprocessed. Integration messages contain the number of retries, so we don't do this endlessly.
Although this implementation adds things like
NotBeforeUtc
to support scheduling messages and obeyingRetry-After
headers, we ignore that for the RabbitMQ implementation. Azure Service Bus will use these directly since it supports scheduling out of the box. RabbitMQ needs a special package to add delay scheduling which adds complexity that self-hosted instances probably do not need.We are also using one dead-letter-queue for all integrations. We could make this per-integration if we wanted to, it just adds more complexity in the configuration / global settings. Since messages in the DLQ are really just for information purposes (i.e. we're not planning on programmatically re-queueing them), it seemed cleaner to put them all in one place where they could be viewed.
Lastly, this PR also cleans up some of the
Startup.cs
files with some methods in ourServiceCollectionExtensions
.⏰ Reminders before review
🦮 Reviewer guidelines
:+1:
) or similar for great changes:memo:
) or ℹ️ (:information_source:
) for notes or general info:question:
) for questions:thinking:
) or 💭 (:thought_balloon:
) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:
) for suggestions / improvements:x:
) or:warning:
) for more significant problems or concerns needing attention:seedling:
) or ♻️ (:recycle:
) for future improvements or indications of technical debt:pick:
) for minor or nitpick changes