mule with drools

12
Mule with Drools

Upload: javeedmhd

Post on 13-Jan-2017

193 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Mule with drools

Mule with Drools

Page 2: Mule with drools

Drools : Drools is a Business Rules Management System (BRMS) solution. It provides a core Business Rules Engine (BRE).Drools supports the JSR-94 standard for its business rule engine and enterprise framework for the construction, maintenance, and enforcement of business policies in an organization, application, or service.

Page 3: Mule with drools

How to use Drools in Mule ??

Page 4: Mule with drools

Mule have Drools component to execute business rules in it’s application

Page 5: Mule with drools

Now, let us create a simple application in our Anypoint studio. This application we will be deploying and running in our Mule Standalone Server and will be using Business rules in our Mule application using Drools

Page 6: Mule with drools

We need to keep a .drl files in our application where all the business rules will be defined .. In our case all the business rules are in this routingRules.drl file:-

Page 7: Mule with drools

Rules in the routingRules.drl are defined as follows:-

You can see the rules that if weight variable value is less than or equal to 50 then WAREHOUSE_B will be as printed as destination or else WAREHOUSE_A will be printed

Page 8: Mule with drools

You can see Mule code that the variable weight is generated randomly and the value of the weight is been checked by the Drools component which is referring routingRules.drl where all the rules are set :-

Page 9: Mule with drools

You can see the value in weight variable is generated randomly and the destination value is set to WAREHOUSE_B as defined in .drl file

Now we test our application by hitting http://localhost:8082/example and we will get the following:-

Page 10: Mule with drools

You can see the value in weight variable is again generated randomly and the destination value is set to WAREHOUSE_A as the weight value is greater than 50 and the rules are defined in .drl file

Now we hit the url http://localhost:8082/example again and we will get the following:-

Page 11: Mule with drools

In my next slide I will bring some other techniques in Mule implementation .Hope you have enjoyed this simpler version. Keep sharing your knowledge and let our Mule community grow

Page 12: Mule with drools

Thank You