Sample application that shows how to integrate a Play Framework (Java) application with Drools.
Code:
app/controllers/Application.java HTTP request handlers
app/plugins/Drools.java A singleton that sets up the Drools Session
app/drools/Message.java A Value Object that is sent to the rules engine
conf/routes Defines a / HTTP handler pointing to app.controllers.Application.index()
conf/META-INF/kmodule.xml Config file for Drools that sets up a knowledge base pointing to the drools package
conf/drools/HelloWorld.drl A simple rule definition
build.sbt The build configuration that specifies dependencies on Drools
Run Locally:
-
Get this repo (e.g.
git clone https://github.com/jamesward/play-drools.git
) -
Run:
./activator ~run
-
Try it: http://localhost:9000
-
The console should show a message was received and processed:
goodbye, world hello, world
Run on Heroku:
-
Get this repo (e.g.
git clone https://github.com/jamesward/play-drools.git
) -
Create a new Heroku app:
heroku create
-
Deploy:
git push heroku master
-
Try it:
heroku open
-
Check the logs:
heroku logs
-
The logs should show a message was received and processed:
2015-12-10T19:47:34.597939+00:00 app[web.1]: goodbye, world 2015-12-10T19:47:34.594001+00:00 app[web.1]: hello, world