programming4us
 
Applications Server
 

BizTalk Server 2009 : Playing By The Rules? Use The Business Rule Engine - Going to Production

6/20/2013 7:54:10 PM

Once all business policies and their required vocabularies are defined and well tested, you can deploy them to your production environment. You have a few deployment options. The first is to use the BizTalk Administration Console, which lets you add policies to applications. Thus, you can export rules, dependent .NET classes, and other artifacts used by policies into isolated MSI packages for environment deployment. In many cases, it is the easiest solution.

You can also use the Business Rule Deployment Wizard to package the policies and/or vocabulary for deployment. The Business Rule Deployment Wizard will allow you to export a particular version of a vocabulary definition or policy definition to an XML file. After exporting all the required policies and vocabulary definitions, remember to package all fact retrievers and custom .NET classes used as facts in the solution. You will need to deploy those to the Global Assembly Cache on your production server running the BRE. You will also need to copy the XML schema definitions used by facts in your policies and vocabulary to the same directory path in your production environment as your development and testing environments.

NOTE

Remember to modify your database facts to point to your production database before deploying the business policies and vocabulary in production. If not, your rules will either fail or read and write to your test database environment.

For more complicated scenarios, application developers might like to package the rules as well as all other collateral material in an interactive setup for the system administrator to use while deploying the application to production. Such a setup package should also contain schema files, .NET assemblies referenced by the business policies, as well as fact retrievers or policy translators used by the policies meant to be deployed. Using an interactive setup, the application developer can prompt the system administrator for the directory location in which he would like to deploy schemas and other collateral files used by the business policies as well as the production database server and database to be used for different database facts.

POLICY DEFINITION IN XML

The following is a dump of a business policy exported to XML. Note the references to the fact retriever assembly and fully qualified class name, the database server information and table names, as well as the schema file location in the fact definitions.

<brl xmlns="http://schemas.microsoft.com/businessruleslanguage/2002">
  <ruleset name="RFP">
    <version major="1" minor="4" description=""
         modifiedby="myserver\user"
         date="2004-02-15T00:29:02.6381024-05:00" />

<configuration>
       <factretriever>
         <assembly>DbFactRetriever, Version=1.0.1505.34508,
           Culture=neutral, PublicKeyToken=d4e488d64aff1da4</assembly>
         <class>
             Que.BizTalk.RFP.myFactRetriever.RFPDbFactRetriever
         </class>
       </factretriever>
     </configuration>
     <bindings>
       <xmldocument ref="xml_0" doctype="RFPEstimateXML.RulesRFP"
            instances="16" selectivity="1" instance="0">
         <selector>/*[local-name()='RFP' and namespace-uri()=
           'http://RFPEstimateXML.RulesRFP"] </selector>
         <schema>C:\RulesRFP.xsd</schema>
       </xmldocument>
       <datarow ref="db_1" server="myserver\Consulting"
                   dataset="Consulting" table="Rates" instances="16"
                   selectivity="1" isdataconnection="true"
                   instance="0" />
    </bindings>


EXPORTING/IMPORTING A POLICY TO/FROM AN XML FILE

The following code snippet uses the Business Rules Framework to export a policy version to an XML file.

using System;
using Microsoft.RuleEngine;
using Microsoft.BizTalk.RuleEngineExtensions;
namespace SimpleExport
{

   class ExportPolicy
   {
      [STAThread]
      static void Main(string[] args)
      {
         if (args.Length != 3)
            Console.WriteLine("Format: PolicyName MajorVersion MinorVersion");
         else

					  

{
         string policyName = args[0];
         int majorRev = Convert.ToInt16(args[1]);
         int minorRev = Convert.ToInt16(args[2]);
         RuleSetInfo rsi = new RuleSetInfo(policyName,majorRev,minorRev);
         Microsoft.BizTalk.RuleEngineExtensions.RuleSetDeploymentDriver dd;
         dd = new
         Microsoft.BizTalk.RuleEngineExtensions.RuleSetDeploymentDriver();
         string fileName = (rsi.Name + "-" + rsi.MajorRevision +
                                      "." + rsi.MinorRevision + ".xml");
         dd.ExportRuleSetToFileRuleStore(rsi,fileName);
      }
    }
  }
}

The following code snippet uses the Business Rule Engine Framework to import a policy version from an XML file into the Rule Store and deploy it.

using System;
using Microsoft.RuleEngine;
using Microsoft.BizTalk.RuleEngineExtensions;
namespace SimpleImport
{
   class ImportPolicy
   {
      [STAThread]
      static void Main(string[] args)
      {
         if (args.Length != 1)
         {
            Console.WriteLine("Format: ""XML File Name""");
            return;
         }
         String filename = args[0];
         Microsoft.BizTalk.RuleEngineExtensions.RuleSetDeploymentDriver
         dd = new
         Microsoft.BizTalk.RuleEngineExtensions.RuleSetDeploymentDriver();
         SqlRuleStore sqlRuleStore = (SqlRuleStore) dd.GetRuleStore();
         FileRuleStore fileRuleStore = new FileRuleStore(filename);
         RuleSetInfoCollection rsic =
                  fileRuleStore.GetRuleSets(RuleStore.Filter.All);
         foreach (RuleSetInfo rsi in rsic)

					  

{
         RuleSet ruleSet = fileRuleStore.GetRuleSet(rsi);
         bool publishRuleSets = true;
         sqlRuleStore.Add(ruleSet,publishRuleSets);
         dd.Deploy(rsi);
      }
    }
  }
}
 
Others
 
- BizTalk Server 2009 : Testing Business Rules
- Migrating to Configuration Manager 2007 : Migrating Hardware Inventory Customizations, Troubleshooting Upgrade Issues
- Migrating to Configuration Manager 2007 : Side-by-Side Migrations
- Microsoft Dynamic GP 2010 : System and Company Setup (part 7) - Company setup - Posting setup, E-mail setup
- Microsoft Dynamic GP 2010 : System and Company Setup (part 6) - Company setup - Shipping Methods, Credit Cards
- Microsoft Dynamic GP 2010 : System and Company Setup (part 5) - Company setup - Company setup, Fiscal Periods
- Microsoft Dynamic GP 2010 : System and Company Setup (part 4) - Company setup - Multicurrency, Taxes
- Microsoft Dynamic GP 2010 : System and Company Setup (part 3) - Company setup - Account setup
- Microsoft Dynamic GP 2010 : System and Company Setup (part 2)
- Microsoft Dynamic GP 2010 : System and Company Setup (part 1)
 
 
REVIEW
 
- First look: Apple Watch

- 10 Amazing Tools You Should Be Using with Dropbox

- Sigma 24mm f/1.4 DG HSM Art

- Canon EF11-24mm f/4L USM

- Creative Sound Blaster Roar 2

- Alienware 17 - Dell's Alienware laptops

- Smartwatch : Wellograph

- Xiaomi Redmi 2
 
VIDEO TUTORIAL
 
- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 1)

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 2)

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 3)
 
Popular tags
 
Video Tutorail Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS
 
Top 10
 
- Setup Free Media Server To Stream Videos To DLNA Compatible TV, Xbox 360 & PS3 (Play Station 3)
- How To Install Android Market & Google Apps On Kindle Fire
- How To Make Ubuntu Look Like Windows 7
- How To Add A New Account in MS Outlook 2013
- Get Android & Mac OS X Style Gadgets For Windows 7 & Windows 8 With XWidget
- How To Activate Microsoft Office 2013
- How To Install Actual Facebook App On Kindle Fire
- How To Create, View And Edit Microsoft Office Files On Kindle Fire
- Download Attractive Business PowerPoint Templates For Free At SlideHunter
- How To Use And Enable Hibernate & Sleep Mode In Windows 8