Parameters in a Sitecron Job – Sitecore Scheduler Module updated! version 1.1.6

So it’s been a while since I have been using this module in production for a while and very happy with it.  I made a few changes to help improve the usability.  In this iteration I added the option to pass in parameters into the job when it runs.  I have a nice surprise feature coming up shortly which will tie into this.

First I added a few checks and logging which helps us better manage the scheduled jobs. With the parameters, you can pass in parameters in which ever format as you like.  It’s the job’s responsibility to utilize the parameters being passed to it.

For instance you can pass in “Testing123” or “someval=1&who=me&whichone=first”, in the later we could use the Sitecore util and treat it similar to the Sitecore parameters.

I modified the Sitecron Job template to include a Parameters field. If you choose to add a value you could do so in the job(s) in /sitecore/system/Modules/Sitecron

I setup two jobs:

Sitecron_116-2

and Sitecron_116-1

Here is a sample test class which pulls in the parameters:

Once the job executes you can see that it passes in the parameter values in these log entries:

Notice that you can output the execution time and the next scheduled execution time. This can be very useful.

 
GitHub: https://github.com/akshaysura/Sitecron
Market Place: https://marketplace.sitecore.net/Modules/S/Sitecron
For help with Cron Expressions you can use http://www.cronmaker.com/
 
If you need more information please do get in touch with me. I posted the update to the marketplace, I am waiting for the approval. Also I updated the GitHub.

2 comments

  • Jinto Varghese 2 years ago

    Thanks Akshay for building and sharing this module !! This is useful and we are planning to use this in our implementation.

    One nice feature addition would be to enable/disable a job from within Sitecore, as there will be scenarios when you want to temporarily stop running a job. I understand we can do this by changing the Cron expression. The challenge is that the person who is changing should remember to put back the right Cron expression to re-enable the job. So from an Operations standpoint, it would be a lot more easier to have a Checkbox to enable/disable the job from within Sitecore.

    For now, we have used the support for Parameters (enabled=1 or enabled=0) to handle this within our individual jobs.

  • akshaysuraadmin 2 years ago

    Thanks for the comment Jinto. Makes complete sense, I am adding some more functionality shortly, will update this aswell.

Add your comment

Your email address will not be published.