Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Shashant Panwar
Dynamic cron values for cron-trigger-tag
15. Januar 2013 13:19
Antwort

Shashant Panwar

Rang: Junior Member

Nachrichten: 28

Eintrittsdatum: 21. September 2012

Neue Beiträge

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
Hitoshi Ozawa
RE: Dynamic cron values for cron-trigger-tag
15. Januar 2013 13:57
Antwort

Hitoshi Ozawa

Rang: Liferay Legend

Nachrichten: 7949

Eintrittsdatum: 23. März 2010

Neue Beiträge

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
RE: Dynamic cron values for cron-trigger-tag
16. Januar 2013 14:43
Antwort

Shashant Panwar

Rang: Junior Member

Nachrichten: 28

Eintrittsdatum: 21. September 2012

Neue Beiträge

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
Hitoshi Ozawa
RE: Dynamic cron values for cron-trigger-tag
28. Januar 2013 03:50
Antwort

Hitoshi Ozawa

Rang: Liferay Legend

Nachrichten: 7949

Eintrittsdatum: 23. März 2010

Neue Beiträge

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
RE: Dynamic cron values for cron-trigger-tag
29. Januar 2013 12:30
Antwort

Shashant Panwar

Rang: Junior Member

Nachrichten: 28

Eintrittsdatum: 21. September 2012

Neue Beiträge

Thanks Hitoshi.
I will take a look and try to implement it programmaticaly.