Creating scheduler in Liferay
To create scheduler in liferay is easy just adding an entry in liferay-portal.xml and adding your custom logic in do receive method.
1.Add the following entry in liferay-portlet.xml after icon tag and before instansable tag.
"<scheduler-description>" tag you can give your custom description
"<scheduler-event-listener-class>" tag write your custom class where you write your custom scheduler logic.
"cron trigger class " tag , it identifies at what scheduler runs , here scheduler runs at 12 clock at sunday.
<scheduler-entry>
<scheduler-description>scheduler entry</scheduler-description>
<scheduler-event-listener-class>
com.sample.scheduler.SchedulerClass
</scheduler-event-listener-class>
<trigger>
<cron>
<cron-trigger-value>0 0 12 ? * SUN *</cron-trigger-value>
</cron>
</trigger>
</scheduler-entry>
2. public class SchedulerClass implements MessageListener {
public void receive(Message message) {
//write your custom logic here
}
}
http://www.cronmaker.com/
That it you have done with your scheduler
Comments
Post a Comment