-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add AfterLoad lifecycle callback #2009
Comments
Spring Data Elasticsearch does not use events, only callbacks. See https://docs.spring.io/spring-data/elasticsearch/docs/4.3.0/reference/html/#entity-callbacks for information about the events and callbacks. Spring Data MongoDB has both, as there the events were already implemented when the callbacks were introduced. When adding the callbacks we deliberately did not add the events as well. |
@sothawo that's clear. however, I suggest to add a "beforeLoad" callback invocation right before the Document is read into a domain object. (both for spring-data-mongodb and spring-data-elasticsearch projects) (for example can be named like: maybeCallAfterLoad(document, type, collectionName)) |
If it's only the additional callback, that's fine. I can't speak for Spring DataMongo though, you'll need to add an issue there. |
@sothawo sounds great, will do! |
don't forget to add it to the reactive part as well. |
@sothawo ok. can I help with implementation? |
Sure. Fork the repo, create a branch form main - or use the main branch of your fork, add the necessary tests and implementation (see https://github.com/spring-projects/spring-data-elasticsearch/blob/main/CONTRIBUTING.adoc) and then submit a pull request to have your forked branch be merged into this repo's main. |
Hi,
Following #1159 , I suggest to add additionally to the afterSave, afterConvert and beforeSave callbacks, also the beforeLoad.
Similarly to MongoTemplate which emits AfterLoadEvent before the reader is used to read the document (in ReadDocumentCallback).
Thus, Similar functionality would be apprepciated at the Spring Data EntityCallbacks level for both ES and MONGO.
The text was updated successfully, but these errors were encountered: