spring-projects / spring-projects/spring-modulith
Marking event as completed fails silently
@odrotbohm is already working on this.
Since Apr 18, 2024.
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 222
- PR merge metrics
- No merged PRs in 30d
Description
When event serialization is misconfigured, it may happen that the serialized_event stored in the event_publication table will have slightly different value than the serialized event used in EventPublicationRepository#markCompleted. As a result, even though the event was processed successfully, it is never marked as processed.
This is a corner case, but since I've run into it, it may happen that others run into this issue too.
Here's the repository that reproduces the issue: https://github.com/maciejwalkowiak/modulith-mark-as-processed-issue
There are two classes to look at and I tried to explain what happens with comments:
- https://github.com/maciejwalkowiak/modulith-mark-as-processed-issue/blob/main/src/main/java/com/example/ModulithMarkAsProcessedIssueApplication.java
- https://github.com/maciejwalkowiak/modulith-mark-as-processed-issue/blob/main/src/test/java/com/example/ModulithMarkAsProcessedIssueApplicationTests.java
Once you run the test, you'll see in logs where's the problem.
I believe EventPublicationRepository#markCompleted should throw an exception if no rows have been updated. This would make our serialization mistake obvious much sooner.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.