ArangoDB v3.4 reached End of Life (EOL) and is no longer supported.
This documentation is outdated. Please see the most recent version here: Latest Docs
Events
Spring Data ArangoDB includes several ApplicationEvent
events that your application can respond to by registering subclasses of AbstractArangoEventListener
in the ApplicationContext.
The following callback methods are present in AbstractArangoEventListener
:
onAfterLoad
: Called inArangoTemplate#find
andArangoTemplate#query
after the object is loaded from the database.onBeforeSave
: Called inArangoTemplate#insert
/#update
/#replace
before the object is converted and send to the database.onAfterSave
: Called inArangoTemplate#insert
/#update
/#replace
after the object is send to the database.onBeforeDelete
: Called inArangoTemplate#delete
before the object is converted and send to the database.onAfterDelete
: Called inArangoTemplate#delete
after the object is deleted from the database.
Examples
package my.mapping.events;
public class BeforePersonSavedListener extends AbstractArangoEventListener<Person> {
@Override
public void onBeforeSave(BeforeSaveEvent<Person> event) {
// do some logging or data manipulation
}
}
To register the listener add @ComponentScan
with the package of your listener to your configuration class.
@Configuration
@ComponentScan("my.mapping.events")
public class MyConfiguration implements ArangoConfiguration {
...