04-06-2017 11:05 AM
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.
04-07-2017 07:40 AM
First uncomment this part in lib/log4j.xml
and find out if your component is really seen and loaded
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.