November Happy Hour will be moved to Thursday December 5th.

EpiServer 7.5 Scheduled Jobs

Vote:
 

Firstly I think the changes you have made for deployment/cloud enablement look great and, though painful to some, really set the product up to be easier to manage going forward.

I couldn't quite discern from the docs - has the Scheduler been completely removed for pure EpiServer 7.5 sites or is it just a separate install? We are keen to upgrade, but have a number of scheduled jobs that are core to our sites so I want to get the pan for this clear before committing time to the upgrade.

Many thanks,

Matt

#78982
Dec 06, 2013 7:53
Vote:
 

The scheduler service have been removed. Existing scheduled jobs however will still function. They will be executed on the site. A common misunderstanding regarding scheduled jobs are that they are executed in the Scheduler Service, that is not true the job is executed on the site (this is true for previous CMS version as well). The windows service was responsible to keep track on when a job should execute and then make a request to the site to execute the job,

This has now been chnaged so the site itself keeps track on when a job should execute and when that is time it calls the specific job. 

The change though is that with the previous scheduler service (windows service) the service could start up the site in case it was down. Now you need to rely on other mechanism to make sure the site is up, could be a third party ping service or AlwaysRunning mode in IIS.

#78985
Dec 06, 2013 9:02
Vote:
 

Ok great, that is clear thanks.

Out of interest, what mechanism is used to run the scheduler within the site?

Many thanks.

#79042
Dec 06, 2013 21:05
Vote:
 

The execution of jobs within the site is working so that during initialization a check is performed against the database for which jobs that are about to be executed. A Timer will then be setup so a callback is executed when the job is to be run. Execute on the job will then be called on a worker thread (so scheduled jobs are not executed on a web request meaning e.g. HttpContext.Current is null).

#79062
Dec 09, 2013 9:40
Vote:
 

Many thanks Johan, that's great. 

#79205
Dec 11, 2013 6:26
Vote:
 

When running a setup with multiple servers, do we need to handle this somehow so that the scheduled jobs aren't run on all servers?

Or is this handled internally since 7.5?

#81997
Mar 03, 2014 13:38
Vote:
 

Each job will just run on one server at the time, it can be any server that perfroms the execution.

By default all servers might run the job. How it works is that the first server that starts the specified job will mark in the database that it is executing the job and then the other servers will not start execution at that time. And then at next time it might be so that another server executes the job. 

If you want more control, e.g. that a certain server executes all jobs then you can control it with attribute enableScheduler on element applicationSettings. 

#81998
Edited, Mar 03, 2014 13:51
Vote:
 

Hi, does somebody know how to get link to the StartPage from Scheduled Job code (in EPiServer 7.5)?

SiteDefinition.Current.StartPage returns link to correct start page when I visit any page, but when I use the same code from Scheduled Job - it returns null...

 

Thanks

#82996
Mar 24, 2014 13:00
Vote:
 

EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance<EPiServer.Web.SiteDefinitionRepository>.List() will give you a list of all sites. If your job is something that is per/site you could e.g. iterate over all sites and assign SiteDefinition.Current to each site inside the iteration.

#83001
Mar 24, 2014 13:47
Vote:
 

Thanks, Johan, now it works.

So in EPiServer 7.5 to get access to SiteDefinition.Current from Scheduled Job code - we should setup it manually for each configured site?

#83007
Mar 24, 2014 14:30
Vote:
 

If the job is dependent of site you should probably use SiteDefinitionRepository.List() and iterate over the sites and set the SiteDefintion.Current for each site.

You could also add a wildcard host "*" as host for any of the sites (in admin mode under 'Manage websites'). Then that site will be returned as SiteDefintion.Current in cases where the site can not be determined from the request (as for example a scheduled job).

#83008
Mar 24, 2014 14:42
Vote:
 

Hi,

How can I get the link (external one) for a commerce node in a 7.5 scheduler job?

I am trying to do a job that generates xml sitemap with all categories/subcategories/products from an ecommerce solution and I always get exception when trying to get the link from the ContentLink of the nodes.

 

Thanks.

#85651
May 01, 2014 14:10
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.