As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
Hello - I have created an event handler for a scheduled event. The handler will perform a long-running operation. Looking through the Nuxeo code, I see various classes implementing AbstractWork for background processing. My question is: should I consider using the AbstractWork code? Or -- will the event already be running on it's own thread by virtue of the fact that it was invoked according to a schedule?
A scheduled event should be managed by an asynchronous listener.
If you use a synchronous listener, it will execute in the thread of the Quartz process dealing with the scheduling of that event, and such threads are on purpose kept in very small numbers (to avoid consuming unneeded resources — there's actually just one thread in the default platform, see templates/common/config/quartz.properties). If you write such a synchronous listener for a scheduled event then it should execute very quickly, but if it needs to it can also do asynchronous Work by passing a subclass of AbstractWork to the WorkManager method schedule.
templates/common/config/quartz.properties
AbstractWork
WorkManager
schedule
But directly writing an asynchronous listener (which is implemented using a subclass of AbstractWork itself) is simpler.
Awesome. Thanks.
Actually - I have a follow-up question
org.nuxeo.ecm.core.scheduler.TestSchedulerService.testScheduleRegistration is one such test.
org.nuxeo.ecm.core.scheduler.TestSchedulerService.testScheduleRegistration
Thanks again. The code contains the following reference