Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Shashant Panwar
Dynamic cron values for cron-trigger-tag
January 15, 2013 1:19 PM
Answer

Shashant Panwar

Rank: New Member

Posts: 21

Join Date: September 21, 2012

Recent Posts

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
January 15, 2013 1:57 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7990

Join Date: March 23, 2010

Recent Posts

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
January 16, 2013 2:43 PM
Answer

Shashant Panwar

Rank: New Member

Posts: 21

Join Date: September 21, 2012

Recent Posts

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
January 28, 2013 3:50 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7990

Join Date: March 23, 2010

Recent Posts

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
January 29, 2013 12:30 PM
Answer

Shashant Panwar

Rank: New Member

Posts: 21

Join Date: September 21, 2012

Recent Posts

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