cancel
Showing results for 
Search instead for 
Did you mean: 

event listeners

Rodney_Ledo
Champ in-the-making
Champ in-the-making

Hi community.

I am trying to create an event listener, so far, I just want to log a message when my listener is called. See my class below:

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuxeo.ecm.core.event.EventBundle;
import org.nuxeo.ecm.core.event.PostCommitEventListener;

public class EventForwarder implements PostCommitEventListener{

	private static final Log log = LogFactory.getLog(EventForwarder.class);

	public void handleEvent(EventBundle arg0) {
		log.warn("===========New Event=========");
	}
}

I added listener-contrib.xml file(see below) in NUXEO_HOME/nxserver/config

<?xml version="1.0"?>
<component name="event-forwarder" version="1.0">
  <extension target="org.nuxeo.ecm.core.event.EventServiceComponent"
             point="listener">
    <listener name="rabbitMQ" async="true" priority="666" postCommit="true"
              class="{my-package}.EventForwarder">
      <event>documentCreated</event>
    </listener>
  </extension>
</component>

I also added the jar containing my class in NUXEO_HOME/nxserver/bundles directory. After restarting nuxeo and creating a couple of documents from the UI, I do not see the line I am writing in the logs. Is there anything I am missing to register the listener?

Thank you in advance.

1 REPLY 1

Florent_Guillau
World-Class Innovator
World-Class Innovator

First uncomment this part in lib/log4j.xml and find out if your component is really seen and loaded