Walkthrough: Modifying the Policy
This walkthrough provides step-by-step instructions for creating a new version of the POVocabulary, creating a new version of the ProcessPurchaseOrder policy, and using the latest version of the POVocabulary in the new version of the ProcessPurchaseOrder policy.
You must complete the Walkthrough: Adding a Rule to the Policy walkthrough before performing this walkthrough.
Overview of This Walkthrough
This walkthrough contains three procedures, as described in the following table.
|Procedure title||Procedure description|
|To modify the POVocabulary vocabulary||Provides step-by-step instructions for creating a new vocabulary version to modify the value of Maximum number of items allowed from 500 to 1000.|
|To modify the ProcessPurchaseOrder policy to use the updated vocabulary||Provides step-by-step instructions for creating a new version of the ProcessPurchaseOrder policy to use the new version of POVocabulary.|
|To test the solution||Provides step-by-step instructions for testing the solution and verifying that the new policy is in effect.|
To modify the POVocabulary vocabulary
On the Start menu, open Business Rule Composer. If you have Business Rule Composer already open, press F5 or click Reload on the File menu to refresh it.
On a system that supports User Account Control (UAC), you may need to run the tool with Administrative privileges. To do this, right-click the application, and then select Run as administrator.
In the Facts Explorer window, expand Vocabularies, and then expand POVocabulary.
Right-click Version 1.0 - Published, and then click Copy.
Right-click POVocabulary, and then click Paste Vocabulary Version.
Double-click Maximum Number of Items Allowed in Version 1.1 (not saved) to start the Vocabulary Definition Wizard.
Change the value from 500 to 1000.
Right-click Version 1.1 (not saved), and then click Save.
Right-click Version 1.1, and then click Publish.
To modify the ProcessPurchaseOrder policy to use the updated vocabulary
In Policy Explorer, expand Policies, and then expand ProcessPurchaseOrder.
Right-click Version 1.2, and then click Copy.
Right-click ProcessPurchaseOrder, and then click PastePolicyVersion.
Click ApprovalRule in Version 1.3 (not saved).
In Facts Explorer, expand Vocabularies, expand POVocabulary, and then expand Version 1.1 - Published.
Drag Maximum Number of Items Allowed in Version 1.1 - Published to replace Maximum Number of Items Allowed of version 1.0 in the IF pane.
Repeat steps 4-6 with DeniedRule.
Right-click Version 1.3 (not saved), and then click Save.
Right-click Version 1.3, and then click Publish.
Right-click Version 1.3, and then click Deploy.
To test the solution
Click Start, open BizTalk Server Administration. If you have the BizTalk Server Administration console already open, press F5 to refresh it.
Right-click RuleTestApp, and then click Start. If Start is disabled, the application is already running and you can ignore the next step.
Copy the SamplePO2.xml file from the C:\BRE-Walkthroughs directory to the C:\BRE-Walkthroughs\RuleTestSol\Input directory for the orchestration.
You should see an output file in the C:\BRE-Walkthroughs\RuleTestSol\Output directory. Open the output XML file and notice that the value of the Status field is set to Approved.
The value of the Quantity field in SamplePO2.xml is 700. Version 1.3 of the ProcessPurchaseOrder policy compares this value with 1000 instead of comparing it with 500 as version 1.2 did.
A published policy cannot be modified. You must create a new version of the policy to modify it. Similarly, a published vocabulary cannot be modified. You must create a new version of the vocabulary to modify it.
The orchestration invoking a policy by using the Call Rules shape uses the latest deployed version of the policy. For example, if you have versions 1.0, 1.1, 1.2, and 1.3 of the policy deployed, the orchestration uses version 1.3. If version 1.3 is not deployed and version 1.2 is deployed, the orchestration uses version 1.2. Therefore if you want to switch back to using version 1.2, you just need to undeploy version 1.3, and make sure that version 1.2 is deployed.
To use a specific version of a policy from an orchestration, you should use an Expression shape and invoke the rule engine to execute the policy programmatically by using the Policy.Execute method.
Note that version 1.3 of the policy uses the vocabulary definitions from both version 1.0 and version 1.1 of the POVocabulary vocabulary. If you export version 1.3 of the policy to an XML file, and import it to create the policy on a different computer, the import process looks for both versions of the vocabulary. Therefore you need to export both version 1.0 and version 1.1 of the vocabulary and import them before importing version 1.3 of the policy.
After you deploy a newer version of the policy, you should wait approximately 60 seconds before testing the solution. The rule engine update service looks for any updates to a policy every 60 seconds (1 minute) by default. If there are updates, it refreshes the cache with the updated information.
- Now that you have completed this walkthrough, perform the Walkthrough: Tracking Policy Execution walkthrough, which gives you step-by-step instructions for tracking policy execution details.