Skills421 | Training and Consultancy A minimal Spring Boot Drools web service – Scattercode A little while back, I knocked up Qzr to demonstrate using Spring Boot with the Drools rules engine. However, I also wanted to play around with a few more technologies (AngularJS and Spring HATEOAS), so it’s a bit large for just demonstrating exposing Drools rules as an HTTP web service. A few folks found it difficult to pick out the essentials of running Drools in a Spring Boot application, so I thought I’d have a go at creating a simpler application, which does nothing more than that. Hence, the Bus Pass Web Service. Before we continue, I should probably mention that you can grab the source code here: As might be guessed from the project name, for the rules, I took my cues from the Drools Bus Pass example in the Drools project. Assuming that you have a reasonably recent install of Maven and the JDK (I have tested with 8, but I think 7 should be okay), you should be able to do the following from the command line. Build the application: Like this:
How to code rules in Drools Počet prečítaní: 6355 Autor: Marián Koleják , Application Specialist & Tester I work for Davinci on the Skydoo project where the business rules are implemented in Groovy, which is an object oriented, dynamic and scripting Java platform language. I got a task to write rules in DSL (Domain specific language) MVEL for a new project. I went through many pages about the MVEL language and most of them were about the rules platform named Drools, so I dived in. Drools is used everywhere and it grows rapidly, it is almost a standard. Drools was developed by companies JBoss and RedHat on Java platform. Drools Guvnor is a centralized storage for the Drools Knowledge Base (see Blog chapter 2). Another development tool for rules is Corticon. 1. Example 1. Example 2. 2. Drools is an expert system based on knowledge. Rules in Drools are usually defined in the MVEL expression language. Rule attributes: salience - it defines the order of running rulesno-loop - it defines the number of runs. 3. 4. 5. 6.
How to improve Drools performance of rule execution Environment JBoss Enterprise Business Rule Management System Platform (BRMS) 56 Issue Using a profiler, I observed that StatefulKnowledgeSession.insert() is the bottle-neck. How can I tune it? Resolution Please follow the performance tips strewn in docs. Cross-products can become huge and, therefore, have the potential to cause performance problems. Literal Restrictions using the operator '==' provide for faster execution as we can index using hashing to improve performance. One can bind variables to facts and their fields and then use them in subsequent field constraints. Use nested accessors carefully as they have a much greater performance impact than direct field accesses. Do not overuse eval because it reduces the declarativeness of the rules which can lead to a poorly performing engine. Evals cannot be indexed and, thus, are not as efficient as field constraints.