Thursday, February 08, 2007

Publish at a specific time


The nature of the Sitecore scheduled operation is cyclic. The task’s execution time relies on the frequency and interval parameters in the web.config file. This approach has significant benefits. Since there is no way to either prevent the ASP.NET process from recycling or predict the recycle time, the cyclic approach makes it easier to guarantee that your scheduled task will be executed in next timeframe despite ASPNET process terminates the task execution. However, sometimes it is necessary to call a task at a specific time. The best example is the publishing task. This module approaches this scenario. The module’s architecture is depicted below: So the module consists of two components: 1. Console Windows application that invokes a web service. 2. Web Service that calls Sitecore publishing operation. Here you can download archive with the documentation and the module itself. Any feedback is really appreciated.

6 comments:

Unknown said...

Nice work.

maybe there's ways to take it one step further, like samples of how to set it up from sql agent instead of as a task? or maybe create a version that runs as a system service?

anyways, cool stuff.

have a great weekend,

P.

Anonymous said...

Hello,

Thanks for this - is there a way to restrict publishing to a specific item in the content tree? Doesn't seem to be with the way it's set up.

- Andrew

Unknown said...

I think it is quite possible, all depends on your requirements.
If you want to publish specific portion of the content tree, you can adjust the publishing mode in the web service to "Single Item" mode and pass the GUID of the root item.

Unknown said...

Hi,

Is this module still available? The link above is broken.

Corey Burnett said...

Alex,
Does this code also clear the cache on the delivery server in a two server configuration? Or does this code just publish the content but not clear the cache? I am using this in a two server configuration and I am seeing that the content publishes fine but the cache is not cleared.

Corey

Unknown said...

Hi Corey,

The code I provided is not doing that, but you can easily extend the publishing service to handle cache clearings. The challenge here is that you need to publish on one box but clear the cache on both.

Check the Stager component which handles cache clearings very seamlessly:
http://trac.sitecore.net/SitecoreStager

and also this newly developed module by one of our partners:
http://trac.sitecore.net/AutomatedPublisher