melchoir55
melchoir55

Reputation: 7276

Upgrade process from drools 5 (5.5.0.Final) to drools 6

We would like to upgrade from drools 5 to 6 but are trying to first evaluate what kind of time investment that would involve. I've spent a lot of time combing the net and documentation, but nowhere can I find an explanation on the minimally required steps for updating a drools 5 implementation to drools 6. It can't possibly be a simple matter of replacing libraries as the differences between the two seem too stark.

Is anyone aware of documentation which explains the upgrade process enough that we would be able to evaluate the time investment required and eventually use the document to perform the update?

Upvotes: 4

Views: 6494

Answers (4)

In the link provided by Mika'il, you can effectively find some information showing the major differences between the 5.x branch and 6.x one.

For instance, Knowledge API has been replaced by KIE API. So do not forget to change the importation package of RuleContext class in your Java classes defining the imported functions in your DRL rules. In 5.x the RuleContext class where coming from org.drools.runtime.rule package and in 6.x from org.kie.api.runtime.rule package.

If you forget to do it, everything would seem to be fine till the compilation of your DRL (at runtime). At rule compile time, the rule compiler will not be able to do the match between the signature of your method and the method declared in your DRL file. The compiler error message is particularly unintelligible, something like: "The method warning(RuleContext, Object) in the type YourClass is not applicable for the arguments (RuleContext, Account)"

At first glance, we could think that the class Account does not inherit from Object. Of course, it is absurd. In fact, the problem is coming the first parameter that is not from the same package in the Java method and the DRL imported function.

I have lost a lot of time before finding. Sometimes we don't see the most obvious facts. But a better message from the compiler would have helped me...

Upvotes: 0

Ashleigh Gordon
Ashleigh Gordon

Reputation: 1

There is a Knowledge API Legacy5 Adapter that can be used so you can keep the api calls the same.

Upvotes: 0

Gergely Bacso
Gergely Bacso

Reputation: 14661

Not really a complete answer, but ... on top of any planned work you might be able to identify in advance, be prepared for:

  • old implementations being left in the code probably for compatibility (causing confusion)
  • major differences between 6.0.1 and 6.1.0
  • some rules can break (especially if you have bpmn integration in your project)

Upvotes: 0

user3248346
user3248346

Reputation:

This document partly explains some of the major differences.

Major differences between Drools 5 and 6 are:

  • PHREAK – new pattern matching algorithm (not guaranteed to be backward compatible)
  • Knowledge API replaced by KIE API
  • Integration with CDI
  • Projects aligned to Maven conventions

Consequently you will need to:

  1. Restructure your projects so that it follows Maven conventions and has a resource folder with your kmodule.xml file
  2. Specify your Drool resources in the kmodule.xml
  3. Change the API calls to use the KIE API.
  4. Theoretically, your rules should still operate as before even with the new PHREAK algorithm, but I asked Mark Proctor once if it is guaranteed to be backward compatible with Rete and he said no.

Upvotes: 3

Related Questions