留言板

Store job details in liferay quartz-* tables

Michal Radziwonowicz,修改在13 年前。

Store job details in liferay quartz-* tables

New Member 帖子: 7 加入日期: 10-10-28 最近的帖子
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,修改在7 年前。

RE: Store job details in liferay quartz-* tables

Regular Member 帖子: 120 加入日期: 14-7-9 最近的帖子
Hi Michal,

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

Thanks,
Naresh Kallamadi.
thumbnail
David H Nebinger,修改在7 年前。

RE: Store job details in liferay quartz-* tables

Liferay Legend 帖子: 14918 加入日期: 06-9-2 最近的帖子
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,修改在7 年前。

RE: Store job details in liferay quartz-* tables

Regular Member 帖子: 120 加入日期: 14-7-9 最近的帖子
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,修改在7 年前。

RE: Store job details in liferay quartz-* tables

Liferay Legend 帖子: 14918 加入日期: 06-9-2 最近的帖子
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,修改在7 年前。

RE: Store job details in liferay quartz-* tables

Liferay Master 帖子: 978 加入日期: 10-1-3 最近的帖子
Thanks for continuing to bother David. emoticon
thumbnail
Naresh Reddy Kallamadi,修改在7 年前。

RE: Store job details in liferay quartz-* tables

Regular Member 帖子: 120 加入日期: 14-7-9 最近的帖子
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.