Skip to content
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 occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow publication completion to delete database entries instead of setting completion date #748

Closed
odrotbohm opened this issue Aug 5, 2024 · 0 comments
Assignees
Labels
in: event publication registry Event publication registry type: enhancement Major enhanvements, new features
Milestone

Comments

@odrotbohm
Copy link
Member

Currently, an event publication is marked as completed by updating the corresponding row in the database with a completion date. This causes the content of that table to grow over the lifecycle of an application. Developers have to manually purge old entries using the CompletedEventPublications abstraction.

It would be nice if developers could opt into a “complete by deletion” mode, in which, instead of setting a completion date, an event publication row would be deleted instead.

Required steps

  • Introduce a configuration property spring.modulith.events.completion-strategy with two values: UPDATE (current algorithm) and DELETE (new algorithm).
  • EventPublicationRepository implementations would inspect that configuration property to alter their database interaction accordingly
    • Lookup queries would have to alter their where clause
    • Completion queries would need to change from an UPDATE to a DELETE.

I don't think we'd need to tweak the schema initialization functionality, which could theoretically create an optimized schema if the new algorithm is activated. Users usually roll their own schema initialization scripts in production anyway.

@odrotbohm odrotbohm added in: event publication registry Event publication registry type: enhancement Major enhanvements, new features labels Aug 5, 2024
@odrotbohm odrotbohm added this to the 1.3 M2 milestone Aug 5, 2024
@odrotbohm odrotbohm modified the milestones: 1.3 M2, 1.3 M3 Aug 19, 2024
@odrotbohm odrotbohm assigned odrotbohm and unassigned ciberkleid Aug 27, 2024
odrotbohm added a commit that referenced this issue Aug 27, 2024
We now expose a spring.modulith.events.completion-mode property, defaulting the previous behavior to a value of UPDATE. The property can also be configured to DELETE, which will cause the persistence implementations to flip to removing the database entries for event publications instead of setting the completion date.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: event publication registry Event publication registry type: enhancement Major enhanvements, new features
Projects
None yet
Development

No branches or pull requests

2 participants