共用方式為


Pluggable Workflow Services

Applies to: SharePoint Foundation 2010

Pluggable workflow services provide a mechanism that allows external applications or components to programmatically communicate with workflow instances currently running on the server.

Overview

In Windows SharePoint Services 3.0, workflows could respond to a limited number of events. To extend workflow capabilities, developers were required to have a workflow call an external service through code, and then write a Web service that took parameters in order to update a specific running workflow instance. The new workflows in Microsoft SharePoint Foundation 2010 offer broader extensibility than workflows from earlier versions, allowing interaction and response to a greater number of custom events, both internal and external. SharePoint Foundation gives a developer a means of coding workflows to listen for certain external events.

Pluggable workflow services provide a means for workflows to execute up to a specified point, and then wait for information from an external process.

Architecture

The following is the flow of data as a pluggable workflow service starts:

  1. The workflow code starts and loads the workflow engine.

  2. The workflow engine reads channel classes and assemblies from the configuration file.

  3. Channels are loaded from the Global Assembly Cache (GAC) and the workflow runtime is started.

SPWorkflowService is the abstract class that provides services access to the basic functionality and data. All pluggable services must inherit from this class.

Usage Examples

Using pluggable services in a workflow to receive communications from external shipping system

A company has built an extensive order-handling system by using SharePoint Foundation. Each order is represented by a list item in their order list. They use workflows to automate their business processes from order entry to fulfillment. However, for shipping they use various carriers for delivery to their customers worldwide.

Recently they have had some challenges with getting timely updates from the shipping companies and integrating this information in the details of the order. They need a way to automatically receive updates from the shipping company so that their order information is constantly up to date. The shipping companies offer automated systems to notify customers of the delivery status of their shipments.

By using pluggable workflow services, their developer can pause the workflow while it waits for delivery notification from the shipper. When the workflow receives the delivery status, it updates the SharePoint list and continues to the next step in the workflow, which is invoicing.

Development Steps

A workflow service developer needs to implement only two things:

  1. The custom workflow service.

  2. An event handler or Web service to receive the external event and respond by calling the appropriate function in the custom workflow service, allowing the correct workflow to be resumed.

See Also

Concepts

Creating Pluggable Workflow Services