Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I came across a very interesting scenario I need a Timer for Item added Event receiver for a SharePoint List and this list is being added to hundred of Webs. Now each List needs a timer job, which will run for 2 hours and then perform some actions (after 2 hours of after a item is added it will perform some actions..)

I thought about using SharePoint timer job but then using 100's of sharepoint timer jobs would decrease the performance. Does anyone knows what would be the best solution. I can also use K2 2003 to solve the problem.

[Edit] I am about to create a Database table which will store information about Item, as I don't want a timer job to Trawl thousands of sites, will be a performance issue, then a custom timer job will preodically keep checking database, if there is any item exists with date/time passed over 2 hours and perform actions I want it to :).

share|improve this question
    
Creating your own database is going to be more work than creating an SPWorkItemJobDefinition and if you want to make it secure probably also slower. –  Per Jakobsen Jul 25 '12 at 18:20

1 Answer 1

up vote 3 down vote accepted

I would suggest a subtype of the timer job, the SPWorkItemTimerJobDefinition. Waldek Mastykarz wrote a good introduction to using them, and apparently they are available in SharePoint 2007.

Basically, in your event handler you can raise a 'work item' for each item, which includes a date/time that you'd like that item processed. Your timer job then periodically trawls through the system looking for work items that need processed.

This way, you would only need 1 timer job.

share|improve this answer
    
+1, trawling gonna be a issue here tho, as got thousands of webs... –  Muhammad Raja Jul 25 '12 at 13:01
    
Actually, it's not too bad. The Work Items are stored at the SPSite level - so you only have to iterate over the site collections, not the SPWebs, and the timer job looks after that for you. I've used this with some moderately large systems, and it was fine. –  Andy Burns Jul 25 '12 at 14:07
    
hmmm, but for each client we have atleast 3 site collections and there hundreds of clients, and My manager said it wont gonna be efficient so I gonna follow him, but thanks for telling me about this sub timer :) –  Muhammad Raja Jul 25 '12 at 14:16
    
You'll not be able to create anything which is more efficient that an SPWorkItemJobDefinition, the trawling is an UPDATE dbo.ScheduledWorkItems ... WHERE Type = @WorkItemType AND DeliveryDate <= @Now to make sure two instances of the timerjob isn't processing the same items follow by an SELECT for the marked items and this is per content database. There is NO way you can create anything more effective in SharePoint. –  Per Jakobsen Jul 25 '12 at 18:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.