What I am trying to accomplish here is different from the usual "Create and deploy a new custom timer job". So please co operate.
Scenario : I have around 200 lists in my site. Each list gets its data from a third part web service (cutom code / not BCS). The data retrieval happens via Timer Jobs. The Timer Jobs call the web service, gets the fresh data and updates the list items. This is currently working fine with multiple lists and 1 timer job to refresh the data.
Problem : Now the issue I am facing is, each of the lists have its own Refresh Frequency. Say List 1 to 30 needs to be refreshed every 5 mins. List 31 to 60 every 10 mins, etc. I am currently handling this by having a RefreshLastRun timestamp.
This works fine in most of the scenarios - unless the Web service returns large data, in which case it takes more than 5 to 10 mins for the Update to complete on 4 to 5 lists. At the same time, the other lists - they were supposed to be updated 5 mins ago, but are still waiting to get updated because the timer job is busy updating another list, and the refresh is in Que. This is a completely unaccepatable solution to my client because the list with lower frequency duration (5 mins) is of a higher priority than the lists getting refreshed every 10 mins.
My Question is : How do I create a new Timer Job for each list? Whenever I add a new list (through code), I want to create a Timer Job at the same time, which will take care of refreshing the data in this and this list only. This way, I will have a independent Timer Job for each list and dont have to depend on 1 timer job to take all the load. With this approach I will have 200 timer jobs running. Which is OK with my client.
I hope I am able to convey the message. My Timer Jobs are working fine. I dont need suggestions on how to get the timer job working etc. My question is, how do I create a new Job Definition dynamically through code (no deployment).