JBoss Drools Hello World

JBoss Drools Hello World

Jboss Drools: It’s a Business Rules Management System (BRMS) which provide solution to core Business Business Rules Engine (BRE) rules management application. Generally to develop application we do write logic inside the code using loop and if else statement. This way there is no centralize point to check or change business logic because logic could be scattered in many classes objects and chances are same business logic duplicated in many classes. Drools provide solution to this problem where all business logic can be maintain on one location and can be change any time without affecting application code. To start learning Drools its required to first set up and run simple application which prints some message. Here we will set up simple Hello World application and print message on console.

  • Create maven project DroolsHelloWorld. Below is final project structure:

JBoss Drools Hello World

  • To run Drools project you will have to add drools-compiler run-time dependency in pom.xml as below:

  • Because it’s first application so its important to see how we do create Drools file. Install Drools eclipse plugin using this tutorial. To create drools file right click folder (“\src\main\resources\com\javahonk”) –> New –> Other

JBoss Drools Hello WorldJBoss Drools Hello WorldJBoss Drools Hello World

  • Sample.drl file will be created with default template. Copy paste below content in it:

  • Create HelloWorld.java in com.javahonk package:

  • Create test class HelloWorldTest.java inside com.javahonk package to load and print message on console:

  • To run right click HelloWorldTest.java –> Run As –> Java Application you will see below hello world message on console:

JBoss Drools Hello World

  • For more details visit Drools official site here  

download  Download project:  DroolsHelloWorld

Leave a Reply

Your email address will not be published. Required fields are marked *