-
1. Re: How to start with drools and what is the path to follow to learn it in a good way ?
tihamerdcca Jul 8, 2017 11:07 PM (in response to isagarkanojia)Sagar-
That's an interesting question. Too bad you haven't gotten an answer before now.
I presume that your company wants to use rules because some manager read an article about business rules and became convinced that adding Drools to the product would be a good idea. This may be correct, but it would be important for you to understand his expectations and manage them as you are learning Drools. Make sure that he's interested in Drools, not in Red Hat JBoss BRMS, which is a Drools wrapper on steroids, and if you're only starting, probably not something you want to bite off right away. Depending on how many rules you will have, and what exactly your application is, you might be fine with Drools by itself.
First, I would start by reading as much of the documentation as possible, starting with https://docs.jboss.org/drools/release/6.4.0.Final/drools-docs/ (assuming you're starting with version 6.4). They have docs for all their versions, and in many forms (regular html, one big html, and pdf).
Second, look for Drools tutorials and try to follow them.
Third, the essence of a DRL file is relatively simple (as seen in the documentation), but the place to start is with a *really* simple example. When I started, I googled for samples, and found some bare-bones ones that I experimented on using the Red Hat JBoss Developer Studio (i.e. their version of Eclipse). Among other things, it has a DRL Editor that has a Rete View, which is very useful for checking if you've made a syntax mistake). However, the debugging on this editor is pathetically non-existent, as far as I can tell. If you make a java compile error, it won't tell you what the problem is, or even what line it's on. So you need to comment out large chunks of your rules to identify the error. (I'm currently looking at their DRL parsers to see what can be done to remedy this situation --if I find anything, I'll post any answers here).
Anyway, the examples I've seen on the internet are good teaching tools, but they often have missing information and/or mistakes. One of the better ones is at http://www.mastertheboss.com/jboss-jbpm/drools/drools-and-maven-example-project. There are also examples in the documentation https://docs.jboss.org/drools/release/6.4.0.CR1/drools-docs/pdf/drools-docs.pdf
Fourth, you will run into problems, and your biggest problem is that you have nobody to ask when things go wrong. Type your question including the keyword "Drools" into Google, and most likely you will get some clues (usually from StackOverflow) that may help.
Fifth, if you're good at drinking from a fire hose, and your company has lots of money, enroll in one of the Red Hat Training classes.
Good luck!
-Tihamer
-
2. Re: How to start with drools and what is the path to follow to learn it in a good way ?
mccloud Jul 10, 2017 5:06 AM (in response to isagarkanojia)I've got an online BRMS workshop available that can get you started:https://github.com/DuncanDoyle/jboss-brms-6-workshop
Second, there are some good books available on Drools (note that some address Drools 5, which has a quite different API (and algorithm) than Drools 6, however, the concepts are mostly the same:
- https://www.amazon.com/Drools-JBoss-Rules-Developers-Guide-ebook/dp/B005C3LH66/ref=sr_1_1
- Mastering JBoss Drools 6 1, Mauricio Salatino, Mariano De Maio, Esteban Aliverti, eBook - Amazon.com
Furthermore, we've got community forums: Drools - Forum (community volunteer support)
Red Hat also provides trainings on JBoss BRMS (the enterprise version of Drools):
Authoring Rules with Red Hat JBoss BRMS - JB461
Developing Rules Applications with Red Hat JBoss BRMS (JB463)
Implementing with Red Hat JBoss BRMS - JB465
https://www.redhat.com/en/services/training/jb466-implementing-red-hat-jboss-brms-exam
We also have quite some available demo's on BRMS/Drools on: https://www.github.com/jbossdemocentral
Hope this helps,
Duncan
-
3. Re: How to start with drools and what is the path to follow to learn it in a good way ?
tihamerdcca Jul 10, 2017 8:22 AM (in response to isagarkanojia)I discovered a source of help on how to find errors in DRL code (i.e. the rules).
Actually, I first found Chapter 8.4.2 Error Message Description" in the Drools 6.4.0 docs (Chapter 8. Rule Language Reference ), and I thought to myself, "This is such a good list of errors, and so much thought went into it. Why can't I see them?"
The secret (thus far) is that I can't see them from the Eclipse (Red Hat JBoss Developer Studio 10.4) IDE, presumably because I can't run the standard Drools parser directly from the IDE. Or, more precisely, the DRL editor doesn't run them constantly, as the Java Editor runs it's Java parser. However, I had built a JUnit in my src/test/java that executes the rules with some test data, and when I do a maven install (or test) on the project, the tests run, and if there are any errors in my DRL, this is when I can see them. For example:
2017-07-10 08:07:57,525 [main] ERROR [builder.impl.AbstractKieModule] Unable to build KieBaseModel:rules
Unable to Analyse Expression ndc4 == 1234:
[Error: unable to resolve method using strict-mode: gov.hhs.cms.mdp.mdpDataApp.validator.Product.ndc4()]
[Near : {... ndc4 == 1234 ....}]
^
[Line: 35, Column: 6] : [Rule name='NDC1 should be 5 Digit Numeric Values Only.']I hope that helps. This discovery certainly made my life a lot easier!
-
4. Re: How to start with drools and what is the path to follow to learn it in a good way ?
tihamerdcca Jul 26, 2017 10:32 AM (in response to tihamerdcca)Another discovery:
In JBoss Developer Studio, if you right-click on your project -> Configure --> Convert to Drools Project, your DRL Editor might start working like it's supposed to; i.e. if you have an error somewhere, a white X in a red circle pops up in the first line of the rule, and if you hover over it, I will tell you your error. The error also appears in you Problem View.
-
5. Re: How to start with drools and what is the path to follow to learn it in a good way ?
rudyatleti Aug 7, 2017 9:02 AM (in response to tihamerdcca)Tihamer Toth-Fejel escribió:
Fourth, you will run into problems, and your biggest problem is that you have nobody to ask when things go wrong. Type your question including the keyword "Drools" into Google, and most likely you will get some clues (usually from StackOverflow) that may help.
Could not agree more. Good luck is the best advice you can get here.
-
6. Re: How to start with drools and what is the path to follow to learn it in a good way ?
mccloud Aug 7, 2017 9:46 AM (in response to rudyatleti)Actually, Drools has a very active and supportive development community, which includes IRC channels (Drools - Chat real-time ), support forums (Drools - Forum (community volunteer support) ), etc. that allow you to ask any question you want. Second, the development team is very responsive to JIRA and bug reports, and when provided with good reproducers, bugs tend to be solved in days.
So, AFAIK, there are plenty of options to ask for questions (including these forums), where we try to answer most question as accurately as possible. And yes, if you're a company and want to have enterprise support on the BRMS platform, including access to the Red Hat knowledge bases, 24-7 follow-the-sun support, security patches, etc., Red Hat provides a very competitive JBoss BRMS support subscription as well.