Fórum

Store job details in liferay quartz-* tables

Michal Radziwonowicz, modificado 13 Anos atrás.

Store job details in liferay quartz-* tables

New Member Postagens: 7 Data de Entrada: 28/10/10 Postagens Recentes
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, modificado 7 Anos atrás.

RE: Store job details in liferay quartz-* tables

Regular Member Postagens: 120 Data de Entrada: 09/07/14 Postagens Recentes
Hi Michal,

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

Thanks,
Naresh Kallamadi.
thumbnail
David H Nebinger, modificado 7 Anos atrás.

RE: Store job details in liferay quartz-* tables

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
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, modificado 7 Anos atrás.

RE: Store job details in liferay quartz-* tables

Regular Member Postagens: 120 Data de Entrada: 09/07/14 Postagens Recentes
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, modificado 7 Anos atrás.

RE: Store job details in liferay quartz-* tables

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
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, modificado 7 Anos atrás.

RE: Store job details in liferay quartz-* tables

Liferay Master Postagens: 978 Data de Entrada: 03/01/10 Postagens Recentes
Thanks for continuing to bother David. emoticon
thumbnail
Naresh Reddy Kallamadi, modificado 7 Anos atrás.

RE: Store job details in liferay quartz-* tables

Regular Member Postagens: 120 Data de Entrada: 09/07/14 Postagens Recentes
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.