We can create the scheduler by defining the entries in the liferay-portlet.xml with specfying the only particular entries. what if scheduler what to change based on the user input.   so here is the code,  String cron = "0 0/1 * 1/1 * ? *";       Portlet portlet = PortletLocalServiceUtil.getPortletById("new_WAR_UserSearchportlet");    Trigger trigger = null;    try {     trigger = TriggerFactoryUtil.buildTrigger(TriggerType.CRON, Scheduler.class.getName(), Scheduler.class.getName(), new Date(), null, cron);    } catch (SchedulerException e) {     e.printStackTrace();    }       Message message = new Message();    message.put(SchedulerEngine.CONTEXT_PATH, portlet.getContextPath());    message.put(SchedulerEngine.MESSAGE_LISTENER_CLASS_NAME, Scheduler.class.getName());    message.put(SchedulerEngine.PORTLET_ID, portlet.getPortletId());       try {     SchedulerEngineUtil.schedule(trigger, StorageType.PERSISTED, "", "liferay/scheduler_dispatch", mes...
 
Comments
Post a Comment