Running Drools on GraalVM - drools

We have a service that uses Drools quite heavily. Would like to improve the performance by running it on GraalVM.
Is it possible to run Drools on GraalVM without using Kogito?

Disclaimer: I'm one of the Drools developers
It's definitely possible, as you've already notice, we do indeed support native image compilation with our Quarkus backend, but it'll require you to write you some code, there's no such possibility in the current codebase.
Please note that only the executable model will be supported with the static component injection (the drools-core-static module in Kogito)
Is there a reason why you don't want to use Kogito though? We are really interested. Please join our community channels or the mailing list if you want to share your feedbacks, as SO is not the best platform for it.
Thanks for your support

Related

It is possible to Integrate Activiti with Drools rule engin

I am working on a project and trying to evaluate Drools vs Activiti.
I know there is jBPM support but my client needs Activiti for managing the business flow and I need to use rule engin for evaluating some cases.
So is it possible to integrate drools and activity. Any pointer would help.
As I mention in the Gitter channel this is totally possible.
I will recommend you to do a small PoC (Proof of Concept) to really understand the details of it. People usually underestimate the complexity of a Rule Engine like Drools. Don't get me wrong, I love Drools, but I recommend you to check the docs and one of their books ;)
Check out the chapter in Tijs Rademaker's book "Activiti in Action". It describes the drools integration for version 5.x of Activiti very completely. The concepts are still valid for Activiti 6 as well.

Drools on Spark with Scala

I am starting a project where we have a lot of business rules. I have strongly been considering using the JBoss rules engine, Drools.
My project uses Scala and uses the Spark engine. I am wondering if anyone has experience, or advice, using Drools with Spark/Scala.
If you looked into Drools and decided against it, I would like to know that too.
I have read several blogs on how people integrate Drools with Spark, or Drools with Scala, but I didn't find any good examples explaining Drools on Spark with Scala. I have seen this with a mixture of Scala and Java, but never pure Scala. I am not sure if this is possible.
Update: Clarifying Question
Would you recommend Drools?
How about with Spark/Scala?
If you looked into Drools and decided against it, I would like to know
that too.
I would not advise that. We are forced to use drools in one of our components and all developers in a team find this solution full of cons:
Java 8 support: scala is moving towards java 8 (see this and
this regarding runtime). Drools started to support java 8 only
in 2 years after its release.
IDE support: eclipse only. We were not able to get it done in
Intellij idea.
General purpose: we did come up with the idea, that whatever you
write using drools rules engine could be written in java/scala
easily. You would say that business logic can get too technical?
Possibly, but you would not have to learn some kind of scripting language
to create business rules.
1) Yes, I would recommend Drools. I have no experience with other rule engines, but the projects I have developed using Drools have worked perfectly so far. Truth be told, I have only used the basic functionality of Drools (never used salience explicitly, Agendas, etc). However, the functionality I have used has solved my requirements perfectly.
2) I have used Drools with both Java 7 and Scala 2.11. I haven't found any particular thing I was able to do with Java but not in Scala. My latest project is using Apache Spark with Scala and Drools, and everything fits together nicely.
If you are going to use Scala, then your facts (the objects that model your domain; aka the 'bean') should have public access modifiers on the val or var you are going to access within the rules. If you need static methods or attributes, then use Objects and import them in the rule file.
Hope this helps

How to build a ConcurrentLinkedHashmap using Guava?

Several links show that https://code.google.com/p/concurrentlinkedhashmap/ has been ported to Guava, but I can not find the corresponding API in Guava.
Can anybody show me an example to build a ConcurrentLinkedHashmap using Guava ?
Thanks!
ConcurrentLinkedHashmap API wasn't ported to Guava 1:1, but some solutions from CLHM were used in MapMaker and Cache (with CacheBuilder).
ConcurrentLinkedHashmap's author Ben Manes answers a question which may clarify your doubts: What does it mean that ConcurrentLinkedHashMap has been integrated into Guava?:
Guava is the long term replacement and most of the time you should use it. The history is that ConcurrentLinkedHashMap figured out the algorithms, Guava subsumed it, and then focused on adding features.
I think it's also important to note that he's currently writing another library which may suit your needs:
Caffeine is a Java 8 rewrite of Guava's cache. It tries to provide the best of ConcurrentLinkedHashMap and Guava, modernized with Java 8, and adopting the techniques that I've learned since those previous projects.

Sample Application Using Drools5

I am working on the Drools5.I am new to this Drools.I need a sample working example for this Drools.For this i have googled it alot but i did not find the correct one.If anyone has an idea can give me the reply.
Since I'm on the same boat as you are, I've searched for learning material quite a bit. Here are my resources:
http://www.jboss.org/drools For the general portal for the project.
Since this project has nicely modularized submodules, here they are:
Drools Guvnor for the Management Module that is used to manage packages of rules and POJOs with versions and also for deployment of snapshots for external usage.
Drools Expert for the expert systems core of the project. Here you can get a first look at how rule processing works under drools.
Drools jBPM5 for business workflow process modeling and integration.
Drools Fusion for Complex Event Processing (CEP) with which you can do all timeconstraint sorts of pattern matching you could think of (my favorite by the way ;).
Drools Planner for planning and business resource optimization.
For each of them, there is a complete and in my opinion high quality documentation out. In there you can really get a hands on an start digging in. You could also start working through one or the other of my personal list:
Getting started with drools fusion, by TheJavaDude
Creating Category, Package, Declarative Model, Rules And Snapshot In Drools Guvnor[Video]
Mark Proctors introduction to drools at FOSDEM[Video]
I hope this helps.
Greetings,
Kjellski

How safe is apache Commons-javaflow while using jasperreports

I am using jasperreport and trying to pass an alternate report runner.
• net.sf.jasperreports.engine.fill.JRThreadSubreportRunner: The initial thread-based
implementation
• net.sf.jasperreports.engine.fill.JRContinuationSubreportRunner: A Javaflow-based
implementation
I am using the second one (for the reason, it runs on tomcat server, and creating threads wouldn't be good while writing subreports). The second one depends on commons-javaflow which is a sandbox version.
Not sure if I should use it, Could somebody suggest a better way.
Thanks
While javaflow is a sandbox component, it is fairly mature, and many people use it in production. If have worked out all of the class-loader/bytecode transformer steps you need to take, it should be safe to use.
I would write several automated tests (just to be sure), and then use it.
I hope i got the question right
Actually JasperReports depends on many open source libraries, including Apache-Commons and iText among many others. I use JasperReports on multiple computers ranging from PCs to a mainframe. I believe you are safe.