Message Boards

how to replace deprecated SchedulerEntryImpl.setTrigger()?

Binu Purushothaman, modified 3 Years ago.

how to replace deprecated SchedulerEntryImpl.setTrigger()?

New Member Posts: 4 Join Date: 7/2/20 Recent Posts

Hi,

We are upgrading LR 7.0 to 7.2 and the uprade planner shows that SchedulerEntryImpl.setTrigger() is deprecated with no direct replacement!

The code is implemented same as https://liferay.dev/blogs/-/blogs/liferay-7-ce-liferay-dxp-scheduled-tasks

Could you point to me to the new implemenation I should use?

Has anyone else continued with the deprecated method and faced any issues in 7.2?

 

 

thumbnail
Mohammed Yasin, modified 3 Years ago.

RE: how to replace deprecated SchedulerEntryImpl.setTrigger()?

Liferay Master Posts: 591 Join Date: 8/8/14 Recent Posts

Hi ,

You can use deprecated method it should not cause any issue , as per latest implementation you can try below code also. Refer 
 

Trigger trigger = _triggerFactory.createTrigger(jobName, groupName, startDate, endDate, cronExpression)

SchedulerEntry schedulerEntry = new SchedulerEntryImpl(className, trigger);

_schedulerEngineHelper.register(messageListener, schedulerEntry, destinationName);

private SchedulerEngineHelper _schedulerEngineHelper;
@Reference
private TriggerFactory _triggerFactory;