SharePoint Workflow Schema (ii) Workflow event processing pipeline (Events processing Pipeline)

Source: Internet
Author: User

[Translator Press] Andy Li's article is the best and most thorough article I've ever seen about the SharePoint workflow architecture. By reading his article, I was clearly aware of the workings of SharePoint workflow and knew how to find a problem when I encountered a problem. Therefore, I hope to be helpful to the developers of workflow.

This blog is made up of Andy Li contribution, he was SharePoint Developer Support Group of engineers who handle difficult issues. The original address. This series on Workflow , which he contributed to the community, helped us to better understand the internal mechanisms of the Workflow Runtime and how to SharePoint interaction.

This article is translated by Spfarmer.

Top two addresses:

Hosting service (Hostservice): Spwinoehostservice

The combination of SharePoint and workflow runtime

Workflow Event Processing Pipeline (Event processing Pipeline)

almost all theWorkflowrequire some user interaction. For example, yourWorkflowyou may need to create someTaskand give it to some users for approval. When they receive theirTask, they will open the site, submit their feedback, and the feedback will be sent backWorkflow, and then continue execution. User submits aTaskafter that, there are a lot of actions in the background. Earlier we mentioned that when a user submits aTaskthe time, aEvent Receiverwill respond to this event andTaskthe changes passed toWorkflow. Usually we call this process event delivery,Workflow Runtime, this is called data exchange. What they say is a meaning. In this section, we will talk about all the actions in this process.

Workflow Data Exchange Services (Data Exchange Service)

Workflow the host process can and through the custom local communication service and Workflow communication. These local communication services implement Custom interfaces that define methods and events that communicate between workflow and host processes. Events are used to send data to workflow. Conversely,workflow uses methods to send data to the host process.

The following icon shows how the local communication service communicates with his host process. You can read the Using localservices in Workflows to get more information.

For example,SharePointdefines the itaskservice to handle theSharePointand created thisTaskof theWorkflowExchange task information in. Itaskservice.createtask wasWorkflowinstance is used toTasklist inside CreateTask item. itaskservice.ontaskchanged event isSharePoint (Host Process)used to launch"Event"to theWorkflowExample.

A service class that implements these interfaces is required to actually complete these data exchanges. For example microsoft.sharepoint.workflow.spwinoetaskservices   implements Itaskservice   interface. This service class actually implements the sharepoint task

workflow   handleexternaleventactivity   and callexternalmethodactivity How to get involved in this thing. >sharepoint in style= Color:rgb "42,42,42 ( createtask  activity   Itaskservice.createtask callexternalmethodactivity  


with Ilspy Check it out. itaskservice definition of:

Now, let's explain.Correlationhow it works. To put it simply,Correlationparameter isWorkflow Runtimeused to find the correct delivery destination for the event. You may still remember inSharePoint, each oneTask Activityall NeedTaskIdParameters(View the above). Attention. CreateTaskhave acorrelationinitializationmethod, that is, in this method, create a newTaskId, this value isTaskof otherActivityuse, such as, OnTaskChanged activity.  after that, when a user submits thisTaskthe changes,Workflow RuntimeUse thisTaskIdto find OnTaskChanged activity, this is where the event should be delivered.(Remember that there can be multipleWorkflow InstancesThere may be multiple OnTaskChanged Activitiesin the system.).  

How does the Correlation work?

Correlationparameterattribute an identifier ( identifier) was defined for the data interchange . each method or event on an interface is a parameter of life, as in Itaskservice interface shown in the example TaskId. You can also use other properties to describe more complex Correlation Match .

any operation that opens a session, either a method or an event must haveCorrelationinitializerattributeProperties, for example, itaskservice.createtask and theItaskservice.createtaskwithcontenttype is the beginning of the conversation. When the call has Correlationinitializerattribute property is used when the,The service class knows that along with this call a new session begins. Workflowof the sessionLifetime isis byCorrelation Referenceof theLifetimedominated by.

The following shows the Visual Studio in createtask Activity 's properties. Note that we have bound the TaskId property to the Task1_taskid1 Property of this class . In method invoking (createtask1_invoking ()) , we initialized with a new GUID TaskId.

Don't confuse Correlation parameter and the "CorrelationToken". notice in the above CorrelationToken the value is "Tasktoken". and the same Workflow in OnTaskChanged activity ( not shown here ) using the same  correlation token. This means that they are the same conversation.

once"TaskId"was createtask or createtaskwithcontenttype activityInitialize,He's going to get the same thing later.CorrelationTokenof theTask Activityshared. So they'll know which one.Taskthe event. And then when the listener arrivesitaskservice.ontaskchanged of the eventOnTaskChangedActivitywhen,it inWorkflow Runtimean event was registered on the. then, whenWorkflow Runtimefrom the host process(SharePointProcess, w3wp or Owstimer)Accept OnTaskChanged event when,She checkedEventArgsof thetaskIdthe value,then, forward the event to have the sameTaskId Correlationof theOnTaskChangedActivity.

SharePoint Workflow Schema (ii) Workflow event processing pipeline (Events processing Pipeline)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.