Foros de discusión

Dynamic cron values for cron-trigger-tag

Shashant Panwar, modificado hace 11 años.

Dynamic cron values for cron-trigger-tag

Junior Member Mensajes: 28 Fecha de incorporación: 21/09/12 Mensajes recientes
Is there any way I can dynamically pass cron values to cron-trigger-value tag or stop it dynamically.
My scenario is: I will receive a file at a location, my job will keep on polling on that directory .the moment job will get the file it will process it.
Now I want to stop the job once I am done with my file(or make sure it will look for next month now),so that it will not process the file recursively as I have a limitation neither I can remove the file nor change the name.
I have to run the job on 24th of every month.

Thanks,
Shashant
thumbnail
Hitoshi Ozawa, modificado hace 11 años.

RE: Dynamic cron values for cron-trigger-tag

Liferay Legend Mensajes: 7942 Fecha de incorporación: 24/03/10 Mensajes recientes
Instead of using tags, you'll need to programmatically create quartz jobs.

See the following thread for information:
http://www.liferay.com/community/forums/-/message_boards/message/11799978
Shashant Panwar, modificado hace 11 años.

RE: Dynamic cron values for cron-trigger-tag

Junior Member Mensajes: 28 Fecha de incorporación: 21/09/12 Mensajes recientes
Thanks for the post.But I am still not getting the concept of scheduling via program.
Can you or somebody explain it in a easier way?
I am unable to understand how stuff will work without entry in liferay-portlet.xml.
How this whole Schedular entry thing works?

SchedulerEntry entry = new SchedulerEntryImpl();
entry.setEventListenerClass(someClassName);
entry.setTriggerValue(someCronString);
entry.setTriggerType(TriggerType.CRON);
entry.setDescription(someClassName);

SchedulerEngineUtil.schedule(entry, this.getClass().getClassLoader());


Thanks for the help in advance.
Shashant
thumbnail
Hitoshi Ozawa, modificado hace 11 años.

RE: Dynamic cron values for cron-trigger-tag

Liferay Legend Mensajes: 7942 Fecha de incorporación: 24/03/10 Mensajes recientes
Check the following code for an usage sample:
\portal-impl\src\com\liferay\portlet\messageboards\service\impl\MBMailingListLocalServiceImpl.java

row 197: protected void scheduleMailingList(MBMailingList mailingList)
Shashant Panwar, modificado hace 11 años.

RE: Dynamic cron values for cron-trigger-tag

Junior Member Mensajes: 28 Fecha de incorporación: 21/09/12 Mensajes recientes
Thanks Hitoshi.
I will take a look and try to implement it programmaticaly.