Skip to content

Spring boot drools example using excel file decision table and drl file

Notifications You must be signed in to change notification settings

kh77/springboot-drools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SpringBoot-Drools Example

- DRL File
- Decision Table (excel or csv) , need to add 

Drools maven dependency:

	<dependency>
		<groupId>org.drools</groupId>
		<artifactId>drools-core</artifactId>
		<version>${drools-version}</version>
	</dependency>
	<dependency>
		<groupId>org.drools</groupId>
		<artifactId>drools-compiler</artifactId>
		<version>${drools-version}</version>
	</dependency>
  • For Decision Table

    <dependency>
         <groupId>org.drools</groupId>
         <artifactId>drools-decisiontables</artifactId>
         <version>${drools-version}</version>
     </dependency>
    

Based on 'cardType' and 'price' to get discount

  • Using drl file in the resource : order_offer.drl

     curl --location --request POST 'http://localhost:8080/order/offer' \
     --header 'Content-Type: application/json' \
     --data-raw '{
              "name" : "Ali",
              "cardType" : "ASKARI",
              "price": "1600"
     }'
    

Based on 'membership' and 'newCustomer' flag to get discount

  • Using Excel file : customer_offer.xls

    curl --location --request POST 'http://localhost:8080/customer/offer'
    --header 'Content-Type: application/json'
    --data-raw '{ "name" : "Ali", "membership" : "GOLD", "newCustomer": false }'

About

Spring boot drools example using excel file decision table and drl file

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages