Replicator and while and correlationtoken of the task

Source: Internet
Author: User

Only when the while clause is used

If a while task can only contain one activity, a sequence must contain createtask, ontaskcreated, updatetask, ontaskchaged, completetask, deletetask, and ontaskdeleted to form a task sequence. Note that createtask is an action before creating a task. It is an activity that calls an external method. Because it is a methodinvoking, it is before creation. Ontaskcreated is an action to receive external events after a task is created. It is triggered by the host (MOSS) to complete the creation and transmit a message (including the parameters of the task) to run WF, because it is invoked, it is after creation. Modifying an activity is similar. All creation, modification, completion, and deletion must be a correlationtoken, because this correlationtoken is used to identify the task. If it is different, an error occurs. For example, if it is a correlationtoken and B correlationtoken, B correlationtoken cannot be found during modification. An error is returned.

When creating multiple tasks, you must have completetask or deletetask. Otherwise, when you create a task multiple times in a loop, because the correlationtoken of the task created in the vs design environment is specified, if the task is not completed or deleted, the correlationtoken still exists, so the following error is reported.

Chinese: historydescription: the value declared by "tasktoken" has been initialized.

Historydescription: correlation value on declaration "tasktoken" is already initialized.

When a task is completed or deleted, the correlationtoken of the task you just created will be automatically destroyed, that is, there will be no unique identifier conflict. This process is maintained by whileactivity.

 

If the replicator contains the while

Replicator includes initialized, childinitialized, childcompleted, and completed processing.ProgramThese are all called by the host Moss.

Initialized initializes replicator, which generally defines whether the replicator is serial or parallel.

Childinitialized initializes the child and creates the Child Activity

Childcompleted sub-activity completed

Completed All replicator completed

The while design remains the same, but the only change is that the correlationtoken of the task in replicator is maintained by replicatoractivity, that is, only when the while is exited and childinitialized is executed again, the correlationtoken of the while task is destroyed and a new correlationtoken is created.

So if you have made a custom activty with while, And if you execute the creation in a loop in this while sub-activity, even if you finish the task, the following error will be prompted when creating the task, because the childinitialized task is not executed even though the task is completed, the collelationtoken of the task is still in progress. Therefore, it is meaningless to want to replicator to include while and then create a task to create multiple replicator, because it is necessary to ensure that the task can be created successfully only after it jumps out of while, if the while contains the creation task, it will not be able to achieve the goal. No error is reported unless you want to execute childinitialized (to generate different correlationtoke) when creating a new job again within the while, but no method is available yet. Do not use the following when creating a task:Code

Correlationtoken = new correlationtoken ();
Correlationtoken. Name = "reassigntasktoken ";
Correlationtoken. owneractivityname = "sequenceactivity1 ";
Createtask1.correlationtoken = correlationtoken;
Ontaskchange1.correlationtoken = correlationtoken;
Completetask1.correlationtoken = correlationtoken;

To generate a new correlationtoken, because this error occurs:This operation can not be performed med at runtime.

Chinese: historydescription: the value declared by "tasktoken" has been initialized.

Historydescription: correlation value on declaration "tasktoken" is already initialized.

 

Similar to parallel, the collelationtoken of its tasks is automatically maintained by parllel. Collelationtoken is destroyed only after one branch is executed.

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: info-contact@alibabacloud.com 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.