Saturday, August 18, 2007

Resetting a BRE policy that has been deployed

During the development and testing of Business Rules Engine policies, you will find yourself having to modify a policy that has already been published and deployed. You can go directly to the SQL server and run this command to reset those policies.


    1 USE BizTalkRuleEngineDb
    2 go
    3 
    4 DECLARE @RuleSetID int
    5 
    6 SELECT @RuleSetID = nRuleSetID
    7 FROM RE_Ruleset
    8 WHERE strName IN ( 'LoanApproval', 'LoanNotification')
    9 AND nMajor=1 AND nMinor=0
   10 
   11 UPDATE RE_Ruleset
   12 SET nStatus = 0
   13 WHERE nRuleSetID = @RuleSetID
   14 
   15 DELETE FROM re_deployment_config WHERE nRuleSetID = @RuleSetID
   16 DELETE FROM re_tracking_ID WHERE nRuleSetID = @RuleSetID



To reset a vocabulary that has been published, you will run this other command:



    1 USE BizTalkRuleEngineDb
    2 go
    3 
    4 DECLARE @nVocabularyID int
    5 SELECT @nVocabularyID = nVocabularyID
    6 FROM re_vocabulary
    7 WHERE strName = 'Contoso.ValidStates'
    8 AND nMajor=1 AND nMinor=0
    9 
   10 UPDATE re_vocabulary
   11 SET nStatus = 0
   12 WHERE nVocabularyID = @nVocabularyID



There will be times, that a particular policy, after you have reset its status on the BRE database, it does not go and clear up from cache. If this is the case, then you will need to stop/start the BRE service:


    1 NET STOP RuleEngineUpdateService
    2 NET START RuleEngineUpdateService

note: [The WROX Professional Biztalk Server 2006 book explained this concept]

No comments: