terminatur
terminatur

Reputation: 688

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

  1. Would you recommend Drools?
  2. How about with Spark/Scala?

Upvotes: 2

Views: 6753

Answers (2)

Ander
Ander

Reputation: 513

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

Upvotes: 0

tkachuko
tkachuko

Reputation: 1986

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:

  1. 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.
  2. IDE support: eclipse only. We were not able to get it done in Intellij idea.
  3. 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.

Upvotes: 1

Related Questions