Mule with drools
Click here to load reader
-
Upload
rajkattamuri -
Category
Technology
-
view
182 -
download
0
Transcript of Mule with drools
![Page 1: Mule with drools](https://reader038.fdocuments.in/reader038/viewer/2022100521/586fdca11a28ab18428b6575/html5/thumbnails/1.jpg)
Mule with Drools
![Page 2: Mule with drools](https://reader038.fdocuments.in/reader038/viewer/2022100521/586fdca11a28ab18428b6575/html5/thumbnails/2.jpg)
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](https://reader038.fdocuments.in/reader038/viewer/2022100521/586fdca11a28ab18428b6575/html5/thumbnails/3.jpg)
How to use Drools in Mule ??
![Page 4: Mule with drools](https://reader038.fdocuments.in/reader038/viewer/2022100521/586fdca11a28ab18428b6575/html5/thumbnails/4.jpg)
Mule have Drools component to execute business rules in it’s application
![Page 5: Mule with drools](https://reader038.fdocuments.in/reader038/viewer/2022100521/586fdca11a28ab18428b6575/html5/thumbnails/5.jpg)
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](https://reader038.fdocuments.in/reader038/viewer/2022100521/586fdca11a28ab18428b6575/html5/thumbnails/6.jpg)
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](https://reader038.fdocuments.in/reader038/viewer/2022100521/586fdca11a28ab18428b6575/html5/thumbnails/7.jpg)
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](https://reader038.fdocuments.in/reader038/viewer/2022100521/586fdca11a28ab18428b6575/html5/thumbnails/8.jpg)
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](https://reader038.fdocuments.in/reader038/viewer/2022100521/586fdca11a28ab18428b6575/html5/thumbnails/9.jpg)
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](https://reader038.fdocuments.in/reader038/viewer/2022100521/586fdca11a28ab18428b6575/html5/thumbnails/10.jpg)
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](https://reader038.fdocuments.in/reader038/viewer/2022100521/586fdca11a28ab18428b6575/html5/thumbnails/11.jpg)
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](https://reader038.fdocuments.in/reader038/viewer/2022100521/586fdca11a28ab18428b6575/html5/thumbnails/12.jpg)
Thank You