Foren

Store job details in liferay quartz-* tables

Michal Radziwonowicz, geändert vor 13 Jahren.

Store job details in liferay quartz-* tables

New Member Beiträge: 7 Beitrittsdatum: 28.10.10 Neueste Beiträge
Hi all,

I'm working on the scheduler in portlet. This portlet should store details for scheduled jobs in liferay quartz-* tables. Now job details are stored in RAMJobStore, which is not the best solution: when tomcat will be shut down, the job details will be delated. Did anybody have experience with storing job details in quartz-* liferay tables?

What I alredy did, is adding following lines in portal-ext.properties but it did'nt help:
(I changed jobStore.class from PortalJobStore into JobStoreTX)

## Scheduler

scheduler.enabled=true
scheduler.classes=com.liferay.sampleservicebuilder.util.job.JobSchedulerInterface

## Quartz
 
org.quartz.dataSource.ds.connectionProvider.class=com.liferay.portal.scheduler.quartz.QuartzConnectionProviderImpl
org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.dataSource=ds
org.quartz.jobStore.driverDelegateClass=com.liferay.portal.scheduler.quartz.DynamicDriverDelegate
org.quartz.jobStore.isClustered=false
org.quartz.jobStore.misfireThreshold=60000
org.quartz.jobStore.tablePrefix=QUARTZ_
org.quartz.jobStore.useProperties=true
org.quartz.scheduler.instanceId=AUTO
org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount=5
org.quartz.threadPool.threadPriority=5


Cheers,
Michal
thumbnail
Naresh Reddy Kallamadi, geändert vor 7 Jahren.

RE: Store job details in liferay quartz-* tables

Regular Member Beiträge: 120 Beitrittsdatum: 09.07.14 Neueste Beiträge
Hi Michal,

I too got same issue, Did you find any solution ?

Thanks,
Naresh Kallamadi.
thumbnail
David H Nebinger, geändert vor 7 Jahren.

RE: Store job details in liferay quartz-* tables

Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
Guys you should never be modifying Liferay tables directly.

Instead use the Liferay scheduler API to add jobs, just use the correct storage type value and it will persist across restarts.

https://web.liferay.com/web/user.26526/blog/-/blogs/liferay-7-ce-liferay-dxp-scheduled-tasks
thumbnail
Naresh Reddy Kallamadi, geändert vor 7 Jahren.

RE: Store job details in liferay quartz-* tables

Regular Member Beiträge: 120 Beitrittsdatum: 09.07.14 Neueste Beiträge
Thanks for your help David,

I have written below code in my controller to create job, Scheduler will invoke but when we restarts server scheduler wont call.

Message message = new Message();
message.put(SchedulerEngine.MESSAGE_LISTENER_CLASS_NAME,className);
message.put(SchedulerEngine.PORTLET_ID, portletId);
message.put("portletId", portletId);
Trigger trigger = new CronTrigger(jobName,jobName, cronText);

try {
SchedulerEngineHelperUtil.schedule(
trigger,StorageType.MEMORY_CLUSTERED,
"Message Scheduler Description",
DestinationNames.SCHEDULER_DISPATCH,
message,
0);

} catch (SchedulerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}


Can you provide me some guidance to come out of this problem?


Thanks,
Naresh Kallamadi.
thumbnail
David H Nebinger, geändert vor 7 Jahren.

RE: Store job details in liferay quartz-* tables

Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
Naresh Reddy Kallamadi:
Can you provide me some guidance to come out of this problem?


Seriously? I gave you a blog link where right on the first page there are 3 bullets talking about storage type and it highlights that MEMORY_CLUSTERED is not persisted. And it also talks about PERSISTED.

Makes me wonder why I even bother.
thumbnail
Jack Bakker, geändert vor 7 Jahren.

RE: Store job details in liferay quartz-* tables

Liferay Master Beiträge: 978 Beitrittsdatum: 03.01.10 Neueste Beiträge
Thanks for continuing to bother David. emoticon
thumbnail
Naresh Reddy Kallamadi, geändert vor 7 Jahren.

RE: Store job details in liferay quartz-* tables

Regular Member Beiträge: 120 Beitrittsdatum: 09.07.14 Neueste Beiträge
Thanks David for your reply,

I red all 3 types of memory types in blog which you mentioned, I changed memory type StorageType.MEMORY_CLUSTERED to StorageType..PERSISTED still no luck.

But same thing which I configured scheduler through liferay-portlet.xml is working where memory type is StorageType.MEMORY_CLUSTERED on server restarts as well not working when we set scheduler through coding on server restarts.


Thanks,
Naresh.