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

Publish delete events by repository methods deleteInBatch and deleteAllInBatch methods #2448

Closed
Saturas89 opened this issue Sep 9, 2021 · 1 comment
Assignees
Labels
type: enhancement A general enhancement

Comments

@Saturas89
Copy link

The repository methods(deleteById/deleteInBatch/deleteAllInBatch) do not trigger domain events.

In the class EventPublishingMethod in File EventPublishingRepositoryProxyPostProcessor.java
there is a method to check, if the method is a delete method.

private static boolean isDeleteMethod(String methodName) { return methodName.equals("delete") || methodName.equals("deleteAll"); }

I would suggest similiar to the isSaveMethod:

private static boolean isDeleteMethod(String methodName) { return methodName.startsWith("delete"); }

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 9, 2021
@mp911de mp911de added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 13, 2021
@mp911de
Copy link
Member

mp911de commented Sep 14, 2021

We would include well-known method names to prevent e.g. derived delete methods that accept query parameters and not the actual aggregate root.

@mp911de mp911de self-assigned this Sep 14, 2021
@mp911de mp911de changed the title Domain event is not triggered by repository methods "deleteById/deleteInBatch/deleteAllInBatch" Publish delete events by repository methods deleteInBatch and deleteAllInBatch methods Sep 14, 2021
@mp911de mp911de added this to the 2.6 M3 (2021.1.0) milestone Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants