Skip to content

Instantly share code, notes, and snippets.

@dacr
Last active February 3, 2026 20:22
Show Gist options
  • Select an option

  • Save dacr/dc2a7ea4ba3db399e378166887e13765 to your computer and use it in GitHub Desktop.

Select an option

Save dacr/dc2a7ea4ba3db399e378166887e13765 to your computer and use it in GitHub Desktop.
Drools official minimalist FireKB example / published by https://github.com/dacr/code-examples-manager #f8f7f856-6439-49aa-b2ff-d7a0ab3ce15f/ab7e3982bd6484d820a8098ec2eff9ee858b8a24
// summary : Drools official minimalist FireKB example
// keywords : scala, drools, mvel, ai, knowledgebase, @testable
// publish : gist
// authors : David Crosson
// license : Apache License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
// id : f8f7f856-6439-49aa-b2ff-d7a0ab3ce15f
// created-on : 2019-10-23T22:02:54+02:00
// managed-by : https://github.com/dacr/code-examples-manager
// run-with : scala-cli $file
// ---------------------
//> using scala "3.5.1"
//> using dep "org.drools:drools-examples:9.44.0.Final"
// ---------------------
import org.kie.api._, org.kie.api.runtime._
import org.drools.examples.fire._
val kServices = KieServices.Factory.get
val kContainer = kServices.getKieClasspathContainer()
val base = kContainer.getKieBase("FireKB")
val session = base.newKieSession()
val names = kContainer.getKieBaseNames
println(names)
session.insert(new Fire(new Room("123")))
session.fireAllRules()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment