13 Replies Latest reply on Jul 28, 2020 1:27 PM by Martien van den Akker

    Rules execution in business rules

    3262395

      hi ,

       

       

      I have a requirement to set up business rules and need to determine how many rules executed and how many did not.

       

       

      Scenario : I have 10 rules set up in if then rules ti R1,R2...R10,i have to determine which rule executed(conditions satisfied) and which rule did not.

      Is it possbile in rules engine ?

       

       

      My oracle version : 12.2.1.2

       

       

      Thanks,

      Amith

        • 1. Re: Rules execution in business rules
          Martien van den Akker

          Hi,

           

          You can do Business Rule Tracing in EM: https://docs.oracle.com/middleware/12212/soasuite/administer/GUID-ADDB698E-8A8D-4AB9-B2CB-76165F5C8D20.htm#SOAAG97543

           

          But I'm not aware of a service that provides these details for an execution. I think that the essence of BRE and the underlying algorithm that it desides itself which rules and in which order they are executed.  See also: https://docs.oracle.com/middleware/12212/bpm/rules-user/GUID-FE770341-5FC9-40B6-9D9B-87BC62480BC4.htm#ASRUG99990

           

          Kind regards,
          Martien

          • 2. Re: Rules execution in business rules
            3262395

            Hi Martien,

             

            Thanks for the reply.

             

            Wanted to know about the rule throughput and message throttling in the rules i.e to restrict number of requests going to rules at same time.

            Rules firing limit will help in this case ? Whats the unit(time unit and number of invocations) to set that ?

            Please share your views.

             

            Thanks,

            Amith

            • 3. Re: Rules execution in business rules
              Martien van den Akker

              Hi Amith,

               

              I don't think that is the place to do throttling. Reaad also  https://docs.oracle.com/cd/E17904_01/user.1111/e10228/descfunc.htm#ASRUG644

               

              Message throttling must be done in front of the composite.  Rule Firing Limit is meant to help in debugging the  rules firing if you have a lot of rules that my apply at the same time. I think that if that may be a problem, you first need to review and redesign your rules.

              The doc also says to  use this incase of Out-of-memory problems. But in those cases first review and redesign your rules, but certainly also the your composite and the message sizes. Also then first implement throtthling upfront, using a database table and the DB Adapter for instance. Also check the memory settings of the server. Only in last instance check this as a fall-back scenario.

               

              Kind regards,
              Martien

              • 4. Re: Rules execution in business rules
                3262395

                Hi Martien,

                 

                Thanks for the reply.

                 

                Scenario : I have 20 if then rules configured as of now with 20 input fields, what are the performance considerations to be followed for smooth/optimum execution ?

                 

                The volume of records will be thousands of records coming to oracle rule engine per day say 10000 records per day.

                 

                Thanks,

                Amith

                • 5. Re: Rules execution in business rules
                  Martien van den Akker

                  Hi,

                   

                  BRE is quite fast. I don't have any benchmarks. But I'm not surprised with 20 if-then rules. And if 10000 records are spread out over the day, then you would talk about let say 1.500 msg/day. I'd say that with a 2node soa cluster with enough memory, lets say a heap of 4GB, you should be able to do the job.

                   

                  Kind regards,
                  Martien

                  • 6. Re: Rules execution in business rules
                    3262395

                    Hi Martien,

                     

                    Thanks for the reply.

                     

                    I found out that i will write negative rules to check which rules is failing as i have 10-20 rules to be set up.

                    so if i have to evaluate 10 rules for positive scenario similarly 10 rules for negative scenario.

                    Please let me know how to append the sting values to a variable inside the rules.

                     

                    Requirement is to inform the consumer that these rules failed.

                     

                    <processResponse>

                    <rulesFailed>R1,R3,R4,R5<rulesFailed>

                    <processResponse>

                     

                    Thanks,

                    AMith

                    • 7. Re: Rules execution in business rules
                      Martien van den Akker

                      I would make list:

                      <processResponse>

                      <rulesFailed>

                      <rule>R1</rule>

                      <rule>R3</rule>

                      <rule>R4</rule>

                      <rule>R5</rule>

                      <rulesFailed>

                      <processResponse>

                      Then you can just assert a <rule>.


                      Kind regards,
                      Martien

                      • 8. Re: Rules execution in business rules
                        3262395

                        hi Martien,

                         

                        I have a schema like this :

                         

                          <element name="processResponse">

                            <complexType>

                              <sequence>

                                <element name="claim" type="string"/>

                                <element name="type" type="string"/>

                                <element name="rulesFailed">

                                  <complexType>

                                    <sequence>

                                      <element name="rule" type="string" maxOccurs="unbounded"/>

                                    </sequence>

                                  </complexType>

                                </element>

                              </sequence>

                            </complexType>

                          </element>

                         

                        Should i use assert or assert new : can you give me the expression

                         

                        • 9. Re: Rules execution in business rules
                          Martien van den Akker

                          Hi,

                           

                          I'd use a schema more like this:

                           

                          <?xml version="1.0" encoding="UTF-8"?>

                          <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"

                                      xmlns:rl="http://xmlns.darwin-it.nl/xsd/demo/Rule"

                                      targetNamespace="http://xmlns.darwin-it.nl/xsd/demo/Rule"

                                      elementFormDefault="qualified">

                            <xsd:element name="processResponse"

                                         type="rl:ProcessResponseType"/>

                            <xsd:complexType name="ProcessResponseType">

                              <xsd:sequence>

                                <xsd:element name="claim"

                                             type="string"/>

                                <xsd:element name="type"

                                             type="string"/>

                                <xsd:element name="rulesFailed"

                                             type="rl:RulesFailedType"/>

                              </xsd:sequence>

                            </xsd:complexType>

                            <xsd:complexType name="RulesFailedType">

                              <xsd:sequence>

                                <xsd:element name="rule"

                                             type="rf:RuleType"

                                             maxOccurs="unbounded"/>

                              </xsd:sequence>

                            </xsd:complexType>

                            <xs:simpleType name="RuleType">

                              <xs:restriction base="xsd:string"/>

                            </xs:simpleType>

                          </xsd:schema>

                           

                          (I'm not fond of implicit complex types, I allways use named ones. And also I would create an root-element definition for every named complexType).

                          But in your case I think you should assert a new rule. Maybe you should name the detail element of the RulesFailed list also a RuleFailed (or FailedRule).

                          Then assert a new FailedRule. Because you don't assert a new list, but a new child of the list. The Rules Engine will add it to the list for you.

                           

                          Kind regards,
                          Martien

                          • 10. Re: Rules execution in business rules
                            3262395

                            hi martien,

                             

                            Modified XSD as given by you.

                             

                            cannot able to add rule in assert new.

                             

                            • 11. Re: Rules execution in business rules
                              Martien van den Akker

                              Can you check the facts under the facts node under settings?

                              • 12. Re: Rules execution in business rules
                                3262395

                                Hi Martien,

                                 

                                This approach worked. i changed output in decision function to list and changed the rules_messageTypes.xsd reposne element to maxoccurs="unbounded" so the rules engine created the list for me.

                                Thanks for the help.

                                 

                                One more question :

                                 

                                I have a requirement to execute set of rules R1,R2... R10. If one of the rules condition is satisfied. Next rule should not execute.

                                 

                                Example : R1, R2,...R10 are setup in if then or decision table. If R2 condition is satisfied then rules after R2 till R10 should not be executed.

                                Can this be achieved ? Please advise.

                                 

                                Thanks,

                                Amith

                                • 13. Re: Rules execution in business rules
                                  Martien van den Akker

                                  Hi Arnith,

                                   

                                  Keep in mind what the idea is of the Business Rules Engine: it tries to find a solution for a question. Or in other words it tries to find a goal based on the supplied information.

                                  Based on the information it has, it will build up a rules-agenda. That will fire the rules one by one, which may or may not supply new information. When new info is found, new data is asserted, then it changes the rule agenda. When it finds its goal, the rule-agenda will be empty and it stops.

                                   

                                  So you will need to make the rules interdependend so that they will rule eachother out and/or make sure that the result of the rules will meet the goal. Doing so if R3 will give you the desired answer, the rule engine will stop processing the others.

                                   

                                  Kind regards,
                                  Martien