Top Banner
GETTING STARTED WITH DROOLS MAURICIO SALATINO - ESTEBAN ALIVERTI JBUG DENMARK APRIL - 2016
20

Getting Started With #Drools 6 Slides - JBUG Denmark

Feb 15, 2017

Download

Software

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Getting Started With #Drools 6 Slides - JBUG Denmark

GETTING STARTED WITH DROOLS

MAURICIO SALATINO - ESTEBAN ALIVERTI JBUG DENMARK APRIL - 2016

Page 2: Getting Started With #Drools 6 Slides - JBUG Denmark

GETTING STARTED WITH DROOLS

AGENDA

▸ First steps

▸ What is Drools?

▸ DRL language

▸ Execution Cycle

▸ Our First Drools Project

▸ Drools Common Usage

▸ Drools Common Pitfalls

▸ Integrating Drools

▸ Roadmap (7.x version)

Page 3: Getting Started With #Drools 6 Slides - JBUG Denmark

GETTING STARTED WITH DROOLS

ABOUT US

▸ Mauricio Salatino (aka Salaboy)

▸ Senior Software Engineer @ Red Hat

▸ Drools & jBPM contributor since 2009

▸ http://salaboy.com

▸ Esteban Aliverti

▸ Senior Software Engineer @ Cognitive

▸ Drools contributor since 2010

▸ http://ilesteban.wordpress.com

Page 4: Getting Started With #Drools 6 Slides - JBUG Denmark

GETTING STARTED WITH DROOLS

WHAT IS DROOLS?

▸ Lightweight Rule Engine (a library)

▸ Rule Engine -> Inference Engine

▸ Data Driven -> Forward Chaining Algorithms

▸ Goal Driven -> Backward Chaining Algorithms

▸ Change of paradigm from Imperative (Java) to Declarative

Page 5: Getting Started With #Drools 6 Slides - JBUG Denmark

GETTING STARTED WITH DROOLS

RULE STRUCTURE

▸ rule “Large Orders require approval” //<rule attributes>

When // Right Hand Side Order(items.size >= 10 && total >= 100000) Then // Left Hand Side // Trigger approval process end

Page 6: Getting Started With #Drools 6 Slides - JBUG Denmark

GETTING STARTED WITH DROOLS

DROOLS ENGINE OVERVIEW (STATIC)

Page 7: Getting Started With #Drools 6 Slides - JBUG Denmark

GETTING STARTED WITH DROOLS

DROOLS ENGINE OVERVIEW (RUNTIME)

Page 8: Getting Started With #Drools 6 Slides - JBUG Denmark

GETTING STARTED WITH DROOLS

RULE EXECUTION CYCLE

Page 9: Getting Started With #Drools 6 Slides - JBUG Denmark

GETTING STARTED WITH DROOLS

DROOLS HISTORY

▸ 2003: Created by Mark Proctor and Bob McWhirter

▸ 2005: Acquired by JBoss

▸ 2007: Drools 3.x introduced the first version of the Rete OO Algorithm

▸ 2009: Drools 4.x focused on performance and production ready

▸ 2012: Drools 5.x focused on integration and unification of Drools, jBPM and CEP (KIE was born)

▸ 2014: Drools 6.x focused on infrastructure, deployment and tooling

Page 10: Getting Started With #Drools 6 Slides - JBUG Denmark

GETTING STARTED WITH DROOLS

KIE PLATFORM

▸ Drools

▸ Drools CEP (Fusion)

▸ jBPM

▸ OptaPlanner

▸ KIE Server (Drools, jBPM & CEP unified server)

▸ Uberfire (uberfireframework.com)

▸ KIE Workbench (Drools, jBPM, Optaplanner Authoring, Runtime & monitoring)

▸ KIE Drools Workbench (Drools Authoring)

Page 11: Getting Started With #Drools 6 Slides - JBUG Denmark

GETTING STARTED WITH DROOLS

KIE APIS

▸ KieContainer

▸ KieBase

▸ KieSession

▸ insert(Object)

▸ retract(FactHandle)

▸ update(FactHandle, Object)

▸ fireAllRules() / fireAllRules(int)

▸ KieScanner

▸ kmodule.xml

DROOLS SPECIFICS

Page 12: Getting Started With #Drools 6 Slides - JBUG Denmark

GETTING STARTED WITH DROOLS

OUR FIRST DROOLS PROJECT

▸ Simple JAR Java Maven Project

▸ Add Maven Dependencies

▸ drools-compiler

▸ drools-core (transitive)

▸ kie-api (transitive)

▸ CDI Enabled

▸ cdi-api

▸ weld-se-core

▸ beans.xml

▸ KIE specific

▸ kmodule.xml

▸ conventions over configurations

Page 13: Getting Started With #Drools 6 Slides - JBUG Denmark

GETTING STARTED WITH DROOLS

RULES POWER

▸ Any Java Model (non-intrusive)

▸ Filter Data (Simple Filters)

▸ Correlate Data (Multiple filters between patterns)

▸ Accumulations / Aggregations (accumulate functions)

▸ Inference Chain

▸ Justification Log

▸ Query Data

▸ Truth Maintenance System(TMS)

Page 14: Getting Started With #Drools 6 Slides - JBUG Denmark

GETTING STARTED WITH DROOLS

COMMON PITFALLS

▸ Start simple, don’t over complicate things

▸ Compare with if/else statements

▸ Too much logic on the RHS

▸ Infinite Loop

▸ Complex (Nested) Models - Facts VS Non-Facts

▸ Cross Product - DB/SQL analogy

▸ From/Eval executed multiple time in RHS

▸ External Service Calls (Sync calls)

▸ Persistence

Page 15: Getting Started With #Drools 6 Slides - JBUG Denmark

GETTING STARTED WITH DROOLS

INTEGRATE DROOLS

▸ Inside your app (Embedded)

▸ Knowledge as a Service

▸ Custom

▸ Kie Server

▸ Others

▸ CDI

▸ Spring

▸ Camel

Page 16: Getting Started With #Drools 6 Slides - JBUG Denmark

GETTING STARTED WITH DROOLS

ROADMAP (7.X)

▸ Cloud Deployments

▸ Tooling for the Cloud

▸ Self-service applications (Future)

▸ Different Vertical’s Packages

▸ API refactoring towards

▸ Flexibility

▸ Services

▸ Composition

▸ Drools language improvements

▸ Phreak tuning and fragmentation for distribution

Page 17: Getting Started With #Drools 6 Slides - JBUG Denmark

GETTING STARTED WITH DROOLS

COMMUNITY

▸ www.drools.org / www.jbpm.org

▸ Drools & jBPM Mailing lists

▸ Report Bugs & Suggest Features: jira.jboss.org

▸ irc.freenode.net

▸ #drools

▸ #jbpm

▸ Blogs:

▸ blog.athico.com

▸ salaboy.com

▸ ilesteban.wordpress.com

Page 18: Getting Started With #Drools 6 Slides - JBUG Denmark

QUESTIONS?

GETTING STARTED WITH DROOLS

Page 19: Getting Started With #Drools 6 Slides - JBUG Denmark

GETTING STARTED WITH DROOLS

RETE

Page 20: Getting Started With #Drools 6 Slides - JBUG Denmark

GETTING STARTED WITH DROOLS

PHREAK