Using Events

From GeoNetwork 3.0.x on, there are a number of events you can listen to on your Java code.

Enabling Event Listeners

To enable this on your Maven project, you have to add the event dependencies. Edit the file custom/pom.xml and add the dependencies tag:


Then create the file custom/src/main/resources/config-spring-geonetwork.xml to tell Spring to load your custom beans adding the following content:

<?xml version=”1.0” encoding=”UTF-8”?> <beans xmlns=”” xmlns:util=”” xmlns:context=”” xmlns:xsi=”” xsi:schemaLocation=”” > <bean class=”” ></bean> </beans>

This file should contain a list of all the classes that listen to events inside GeoNetwork scope.

Simple Example

We can add a simple example listener like this one, which will print a string every time a metadata gets removed.


import org.fao.geonet.domain.*;


import org.springframework.context.ApplicationListener;

import org.springframework.stereotype.Component;

@Component public class MyCustomListener implements ApplicationListener<MetadataRemove> {

@Override public void onApplicationEvent(MetadataRemove event) {




For example, we can call an external REST API that gets triggered every time a Metadata gets removed or updated.

GeoNetwork API

There is also a new API you can use to interact with GeoNetwork from an external script. See more on API guide.