Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

To use the framework, the easiest way is to use maven in your project.

So you should add the following dependencies :

Maven dependency for Chtijbug library
<dependency>
      <groupId>org.chtijbug.drools</groupId>
      <artifactId>drools-framework-runtime-base</artifactId>
      <version>1.1.0.3</version>
</dependency>
<dependency>
      <groupId>org.chtijbug.drools</groupId>
      <artifactId>drools-framework-runtime-entity</artifactId>
      <version>1.1.0.3</version>
</dependency>

 

 
        <dependency>
            <groupId>org.chtijbug.drools</groupId>
            <artifactId>drools-framework-runtime-base</artifactId>
            <version>1.1.0.3</version>
        </dependency>
        <dependency>
            <groupId>org.chtijbug.drools</groupId>
            <artifactId>drools-framework-runtime-entity</artifactId>
            <version>1.1.0.3</version>
        </dependency>

You should add the following repository in your settings.xml :

    <repository>
      <id>chtijbug-release</id>
      <name>chtijbug repo release</name>
      <url>http://openesb-dev.org:8081/nexus/content/repositories/chtijbug-release/</url>
    </repository>

Here is a code example :

package org.chtijbug.drools.runtime;
public class Main {
    public static void main(String args[]) {
        RuleBasePackage ruleBasePackage = RuleBaseBuilder.createPackageBasePackage("fibonacci.drl") ;
        try {
            for (int i = 0; i < 1000; i++) {
                RuleBaseSession session1 = ruleBasePackage.createRuleBaseSession();
                Fibonacci fibonacci = new Fibonacci(5);
                session1.insertObject(fibonacci);
                session1.fireAllRules();
                session1.dispose();
                Thread.sleep(2000);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

 

Here in the example, we us one drl file but you can add mores like this :

RuleBasePackage ruleBasePackage = RuleBaseBuilder.createPackageBasePackage("fibonacci1.drl","fibonacci2.drl","fibonacci3.drl","fibonacci4.drl")

And this is it !

 

 

 

 

 

 

  • No labels