What to do with Timer jobs in SP2013
With SP2013 one of the common question developers face is what to do with the custom code they have implemented using Timer jobs. While writing custom timer jobs can technically still be written it will be highly unadvisable to bring custom code to Sharepoint server.
Here are my suggestions for my customers for using alternatives to Timer jobs in SP2013.
If you look at the basic need for Timer jobs it usually boils down to either performing scheduled tasks and/or that an event has occurred in a SP data structure (List/doc lib/pages). There are sometimes needs for a sync job where a timer job syncs data between two sources.
1. SP Workflow : SP workflows can be used for doing event based triggers (usually if sending email is involved). Also with Site workflows they can be on long timer delays and can run in a loop to query for data changes and then perform appropriate actions.
2. Events: List based events can be used to trigger a remote event to manage the data change activity as well.
3. Outside Scheduler : This is the most similar experience to SP timer jobs except there will be no access to server side OM. Outside schedulers either custom .net schedulers(windows service) or Azure scheduling service can be used to trigger code on a time based fashion to perform the operations. Few people I have seen have used "Task Scheduler" in the OS and I personally do not like that option as I am not sure how well it scales.
Now from these three options I am most interested in the 3rd option.
It would be a cool project to write a custom .net service which is installed as an application and is fully trusted to query for data. This service then runs forever and is scanning a predefined list (read from an xml file), you upload your custom dll to this list along with the schedule information on when to run this dll. The service will eventually pick up the dll along with the schedule and call a predefined method (say "Execute") for you in the dll by reflection. Since the service is fully trusted the code should be able to access any list data and can perform various email operation as long as SMTP are properly configured. This will provide for a drop your dll and schedule to run on a schedule and access SP data.
Will let everyone know once I have the code ready for this :). Comments are welcome.
Comments
- Anonymous
June 18, 2014
test - Anonymous
June 18, 2014
Quite useful. Thanks!