RE: Multiple Portal Instances - Cron Scheduler

Abhay Chaware, modified 11 Years ago. Junior Member Posts: 36 Join Date: 7/17/13 Recent Posts
Hi All

I have a question regarding cron/quartz scheduler in Liferay 6.1.1 CE GA2. How does it work with multiple instances / shard enabled ? Does the cron run for *every* instance automatically ? or it runs in central/portal space, and multiple instances needs to be handled programatically within the job ?

e.g. say there is a entity / table called alarmData and it has a column named averageTimeInAlarm. This table is created in every shard / db instance after deployment. averageTimeInAlarm is calculated in batch as a part of cron job. Now, should the cron job implementation have code to connect to each company (instance/shard) and process this, or liferay should automatically run the same cron for every instance ?

Thanks
Abhay
Deniz Burucu, modified 8 Years ago. New Member Posts: 10 Join Date: 6/10/15 Recent Posts
Do you have a solution for this problem?

The cron runs only for central instance. How can I run for every instance the job?
shuchi dave, modified 8 Years ago. New Member Posts: 3 Join Date: 2/26/16 Recent Posts
Hi,

Any solution found for this issue? Can you please share your findings?

I am also facing the same for multi-tenant environment, where only central instance is running all schedulers but no other tenant have those schedulers.

Thanks,
Shuchi
thumbnail
Andrew Jardine, modified 6 Years ago. Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts
Phew -- 6.1, man, that's going back now. And Sharding! talk about the archives of features emoticon

I think the answer is that it's up to you to manage. A portlet is not deployed to a particular instance or to a site. The portlet exists at the server level-- so if you have deployed a TodoList portlet, then Site A on Instance A can add it to a page, but so can Site B n Instance B. It's considered a global asset for lack of a better term. 

Same goes for the scheduled task. The task itself runs at the server level so if you need to do something for one company but not another, then it'll be up to you to look up the list of company ids, or the virtual host record from which you can get the company id, etc. 

Sharding shouldn't matter at all as you simple use the services that Liferay provides and that magic is hidden from you.