SPWorkItemJobDefinition.ProcessWorkItems Method (SPContentDatabase, SPWorkItemCollection, Boolean)
NOTE: This API is now obsolete.
Launches the processing of work items as specified by the job definition and specifies the content database (SPContentDatabase) and work-item collection (SPWorkItemCollection) for processing. Also specifies whether to continue fetching work items when an error is encountered.
Namespace: Microsoft.SharePoint.Administration
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
Syntax
'Declaration
<ObsoleteAttribute("Override the ProcessWorkItems method with SPJobState support instead.", _
False)> _
Public Overridable Sub ProcessWorkItems ( _
db As SPContentDatabase, _
workItems As SPWorkItemCollection, _
ByRef continueProcessing As Boolean _
)
'Usage
Dim instance As SPWorkItemJobDefinition
Dim db As SPContentDatabase
Dim workItems As SPWorkItemCollection
Dim continueProcessing As Boolean
instance.ProcessWorkItems(db, workItems, _
continueProcessing)
[ObsoleteAttribute("Override the ProcessWorkItems method with SPJobState support instead.",
false)]
public virtual void ProcessWorkItems(
SPContentDatabase db,
SPWorkItemCollection workItems,
ref bool continueProcessing
)
Parameters
db
Type: Microsoft.SharePoint.Administration.SPContentDatabaseSpecifies the name of the content database object (SPContentDatabase) against which to run the timer job.
workItems
Type: Microsoft.SharePoint.SPWorkItemCollectionSpecifies the work-item collection (SPWorkItemCollection) that contains the runnable work items.
continueProcessing
Type: System.BooleanBoolean value that specifies whether to continue fetching work items even in cases in which the inner processing loop encounters an error.
Remarks
While the outer processing loop is fetching work items from the queue, it is not able to detect whether work items in the processing queue are present because they are new work items and need to be processed, or whether they are in the queue because a processing error occurred, causing them to be passed back into the queue. In such a case, the outer loop must be informed that, in the event of error, it should break out of processing (that is, set continueProcessing=false). Without this setting, the outer loop could indefinitely continue fetching a work item that is failing to process, and the method would never return control.
Under some circumstances, you might want to support a specific scenario (that is, continueProcessing=true). In such a case, your code must provide logic that, for example, detects the number of times a specific work item has been fetched and, if necessary, reset the flag, exit the method, and return control.
See Also
Reference
SPWorkItemJobDefinition Members
Microsoft.SharePoint.Administration Namespace