I am new to Nuxeo and II am not sure how to catch a scheduled event. This is 
what I do

This is my config

<?xml version="1.0"?>
<component name="test.job">

<extension 
target="org.nuxeo.ecm.platform.scheduler.core.service.SchedulerRegistryService" 
point="schedule">
<schedule id="massImport">
<username>Administrator</username>
<password>Administrator</password>
<eventId>MassImportEvent</eventId>
<eventCategory>default</eventCategory>
<cronExpression>0/30 * * * * ?</cronExpression>
</schedule>
</extension>

</component> 


in my plugin event-contrib.xml looks as follows:

<?xml version="1.0"?>
<component name="test.job.event">
  <extension target="org.nuxeo.ecm.core.event.EventServiceComponent"
    point="listener">
    <listener name="scheduler_event" async="false" postCommit="false"
                       
        class="test.job.StartJobListener">
    </listener>
  </extension>
</component>

This is my java source code

public class StartJobListener implements EventListener{

         public static final String HANDLED_EVENT = "Got event";
       
        public StartJobListener(){
               
        }
       
        public void handleEvent(Event event) throws ClientException {
                System.out.println("start");
                 
                event.getContext().getProperties().put(HANDLED_EVENT, "true");

        EventContext ctx=event.getContext();
        System.out.println("type: "+ctx.getClass().getName());
       
        }
} 



It seems like the event is fired but I got NullPointerException trying to catch 
it. The exeption looks as follows:

15:10:30,021 INFO  [EventJob] Sending scheduled event id=MassImportEvent, 
category=default
15:10:30,021 ERROR [EventServiceImpl] Error during sync listener execution
java.lang.NullPointerException
        at 
org.nuxeo.ecm.core.event.impl.EventServiceImpl.fireEvent(EventServiceImpl.java:144)
        at 
org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:82)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
        at 
org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520) 


Reading the documentation I am confused how to catch events comming from the 
scheduler. So any help and suggestions are welcomed. How to catch an eventof 
the certain id? Thanks in advance.
--
Posted by "JumpAround" at Nuxeo Discussions <http://nuxeo.org/discussions>
View the complete thread: 
<http://www.nuxeo.org/discussions/thread.jspa?threadID=3529#10794>
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm

Reply via email to