Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Business Rule Engine… Plz help
- This topic has 4 replies, 1 voice, and was last updated 6 years, 10 months ago by
community-content.
-
AuthorPosts
-
-
May 23, 2006 at 1:08 PM #14739
Hi,
I have to implement a business rule thru rule engine in BTS 2006.
The rule is very simple.
Get the value from schema field and check if it is in Database table
If yes modify the field value as yes else No.I call this rule thru my orchestartion.
I developed the application and rule/policies deployed similar to one present in SDK sample Loan Processing.
But when I run the orchestration I could not find any changes in the schema output. It seems the rule itself is not fired
1.Can u plz tell me what specific configuarations do I need to do for database connectivity?
2.What parameters do I need to pass thru call rule shape?
3. I am not using any .net components. Is it necessary for me to use fact retriever?
4. How a rule engine identifies the neagtion of a rule. If I test the rule in Rule composer, itseems both the rules have been fired. How to make only one rule to get fired. Is some exra configuration to be done for negation of a rule?
Any help would be appreciated
Thanks
-
May 25, 2006 at 1:22 PM #14740
Thanks, Stephan.
I have following rule
1.If Employee.Emp:/Empname = Northwind.Customer.CustomerName
Action Employee.Emp:/EmpID = 1002. If Not Employee.Emp:/Empname = Northwind.Customer.CustomerName
Action Employee.Emp:/EmpID = 200Initially I have called expression shape in orchestration where I have written following code
SqlConnectivity = new System.Data.SqlClient.SqlConnection(\”Persist Security Info=False;Integrated Security=SSPI;database=Northwind;server=(local)\”);
SqlConnectivity.Open();
SqlTransaction = SqlConnectivity.BeginTransaction();
DatabaseConnectivity = new Microsoft.RuleEngine.DataConnection( \”Northwind\”,\”Customer\”, SqlConnectivity, SqlTransaction );Then I used Call rule shape where I passed two parameters: message variable and Database connectivity (of type Microsoft.RuleEngine.DataConnection)
And when I tested again nothing happens.
Then I found out that for database connectivity we need Factretriever.
So I created C# class file.
My code is as follows
namespace myFactRetriever
{
public class myFactRetriever : IFactRetriever
{
public object UpdateFacts(RuleSetInfo rulesetInfo, Microsoft.RuleEngine.RuleEngine engine, object factsHandleIn)
{
object factsHandleOut;// The following logic asserts the required DB rows only once and always uses the the same values (cached) during the first retrieval in subsequent execution cycles
if (factsHandleIn == null)
{SqlConnection SqlConnectivity = new SqlConnection(\”Initial Catalog=Northwind;Data Source=(local);Integrated Security=SSPI;\”);
DataConnection DatabaseConnectivity = new DataConnection(\”Northwind\”, \”Customer\”, SqlConnectivity);
engine.Assert(DatabaseConnectivity);
factsHandleOut = DatabaseConnectivity;
}else
{
factsHandleOut = factsHandleIn;
}
return factsHandleOut;
}}
}I built and GACed.
Now I configured policy version property for factretriever. But when I test the policy I get following error\”Method or Operation is not implemented\”
This error I am getting even if I run Orchestration also…Now where I have gone wrong?
1.Do I need to have any refernce of factretriver in Biztalk project? But then even policy test itself is failing..
2. Do I need to pass any parameter?
3.how can I make use of this factretriever in rule composer?
4. Should I use the database connectivity expression in expression shape in Orchestration ?It would be great help if you guide me
Thank you
-
May 30, 2006 at 7:33 AM #14741
Hi,
Any one has any idea about this problem or to go about FactRetriever?
Help is really appreciated…
-
May 25, 2006 at 7:25 AM #14742
Here are some quick answers for you.
1. Make sure your rules are deployed and the rules engine update service is running. I’m guessing this is already done or you’d get some errors.
2. You just need to pass in what the rules are expecting. That means if you are using an Xml Fact you need to pass that in. Using the Call Rules shape inside the Orchestration should help with this.
3. No, should need this.
4. Are you sure both rules actually ran? You should see the rule being evaluated.
Hope this helps.
-
May 30, 2006 at 4:33 PM #14743
You don’t need a reference to the fact retriever inside the Orchestration.
Your Fact Retriever looks right to me.
I have not worked with Data Connections inside the rules engine at all so I can’t help much. Have you looked at the Rule White Paper for BizTalk 2004 on the Microsoft site? I’d try looking at that and check the samples in the SDK – if you haven’t already.
Best of luck.
-
-
-
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.