In Liferay we can execute any kind of task in off line, Liferay has provided Quartz Schedular.
Steps to implement Quartz Scheduler:
1. Create a class which implements MessageListener interface.
2. override the method public void receive()
code:
package com.test;
import com.liferay.portal.kernel.messaging.Message;
import com.liferay.portal.kernel.messaging.MessageListener;
import com.liferay.portal.kernel.messaging.MessageListenerException;
public class MyExampleSchedular implements MessageListener {
@Override
public void receive(Message arg0) throws MessageListenerException {
// TODO Auto-generated method stub
System.out.println("This is the Message Listener recive()");
}
}
3. Configure the scheduler class and its details in lifer-portlet.xml file.
4. Time unit can be second, minute, hour, day and week. In the above the scheduler will run every 5 minutes.