Make notifications transactional
Current Behavior
Notifications are currently not transactional, meaning that in certain situations notifications may be dispatched despite the persistence operation that triggered them failed. In case the persistence operation is retried, duplicate notifications may be sent. Both situations could cause consistency issues in systems that consume notifications.
Proposed Behavior
First and foremost, decide whether this is a problem that we need or want to tackle. Fire-and-forget notifications are very low in complexity, everything we do to bind them to transactions will introduce new complexity that simply may not be worth it.
A common pattern to solve this issue is the transactional outbox.
Checklist
- [X] I have read and understand the contributing guidelines
- [X] I have checked the existing issues for whether this enhancement was already requested
Implemented for v5: https://github.com/DependencyTrack/hyades-apiserver/pull/1508