You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If multiple equal events of the same type and same data are published in the same transaction, and then they are all processed, the event publication registry will have about half of them not marked as completed. Even though they're actually all processed without problem.
If making the event data unique in some way, there is no problem. But I can't see any constraints about events having to be unique in the documentation.
There seems to be a race condition, and turning on the SQL trace logging, I see that multiple concurrent tasks will update the COMPLETION_DATE for the same EVENT_PUBLICATION.
2025-02-16T13:56:22.211+01:00 DEBUG 147904 --- [modulith-multiple-equal-events] [ task-4] o.s.jdbc.core.JdbcTemplate : Executing prepared SQL statement [UPDATE EVENT_PUBLICATION
SET COMPLETION_DATE = ?
WHERE
ID = ?
]
2025-02-16T13:56:22.211+01:00 TRACE 147904 --- [modulith-multiple-equal-events] [ task-5] o.s.jdbc.core.StatementCreatorUtils : Setting SQL statement parameter value: column index 2, parameter value [869af431-273d-4407-b2ee-e13d3289e99d], value class [java.util.UUID], SQL type unknown
2025-02-16T13:56:22.211+01:00 TRACE 147904 --- [modulith-multiple-equal-events] [ task-3] o.s.jdbc.core.StatementCreatorUtils : Setting SQL statement parameter value: column index 2, parameter value [869af431-273d-4407-b2ee-e13d3289e99d], value class [java.util.UUID], SQL type unknown
2025-02-16T13:56:22.211+01:00 TRACE 147904 --- [modulith-multiple-equal-events] [ task-6] o.s.jdbc.core.StatementCreatorUtils : Setting SQL statement parameter value: column index 2, parameter value [869af431-273d-4407-b2ee-e13d3289e99d], value class [java.util.UUID], SQL type unknown
…publications.
We now rather use an object identity comparison in TargetEventPublication.isAssociatedWith(…) instead of an ….equals(…) as that would return the wrong publication for identical events.
We have previously used equals(…) when trying to find the event publication currently in progress, which indeed requires the event instances to be unique even if structurally identical. I've revised that arrangement to use object identity now to avoid this limitation. Please give the 1.4 snapshots a try. The M2 release should be out in a few days.
odrotbohm
changed the title
Multiple identical events not being marked completed correctly
Structurally identical events cause wrong publication to be selected for completion
Feb 23, 2025
If multiple equal events of the same type and same data are published in the same transaction, and then they are all processed, the event publication registry will have about half of them not marked as completed. Even though they're actually all processed without problem.
If making the event data unique in some way, there is no problem. But I can't see any constraints about events having to be unique in the documentation.
There seems to be a race condition, and turning on the SQL trace logging, I see that multiple concurrent tasks will update the
COMPLETION_DATE
for the sameEVENT_PUBLICATION
.I have setup a repository that reproduces the problem in a test.
The text was updated successfully, but these errors were encountered: