Drools Happenings 7.0 - Devnation 2016

Post on 15-Feb-2017

1.109 views 2 download

Transcript of Drools Happenings 7.0 - Devnation 2016

Mark Proctor

Drools 7.0 Happenings

Where we are

Where we were mid 2013

6.4• 6.0 Nov 2013 • 6.4 2016

• Upgrade to Pattern Fly • Fully redesign the execution server UI • Improved and augmented process runtime views

KIE - Knowledge Is Everything• Drools • jBPM • DashBuilder • OptaPlanner • UberFire

The Family

Drools

jBPMDashBuilder

OptaPlanner

GWT

Errai

UberFire

Commons

Drools WB

Kie WB

Product Maturity Model

Remote Java Developer

Citizen Developer

Associate Process Manager

Senior Process Manager

Case Management

Case Management

Usability / Pattern Fly

Workbench / Data Modeller

Workbench / Data Modeller

jBPM Reports

jBPM Reports

Execution Server

Web Stack

GWT 2.8 + Errai

• Client-side depending injection (consistent with CDI).

• Client-side templating. • 2-way data-binding with Pojos. • Dynamic runtime modules. • qualifier annotations to determine

which dependencies. • a bean satisfies. • Constructor field and setter injections.

• More CDI and EJB features: • @Alternative, @Specializes,

@Produced scopes, CDI Events, JPA, …

• Injecting native Javascript objects into doc with JSInterop.

• Support for native DOM-based UI • support for GWT 2.8 + Java8.

Errai UI

• Bind Java class elements to elements in an HTML template.

• Template files can be HTML fragments or full pages.

• The HTML file is the template. • The Java class is a template bean • Data field can be @Bound to the model

and automatically updated

Errai - Data Binding

UberFire Rich Client Framework

• Perspective • Screen • Page Composer • Security • Permissions • Preferences (TODO)

Form Builder

Old Form Builder

Bootstrap Grid Views

Bootstrap Grid Views

Web Forms for Java Developers

• Pojo • JPA • Bean Validator

Form Builder Video

OpenShift JVM

Provisioning the Form app

DashBuilder / Page Composer

DashBuilder Example

DashBuilder Example

jBPM Runtime View

Data Set Creation

• SQL • Bean (Java Class) • CSV • Elastic Search

Data Set Configuration

Data Set Preview

Advanced Configuration

Data Set Explorer

Cache

DashBuilder Video

User Group Admin Video

Permissions Video

Execution Server

Rule Execution Server

Rest Call

Rest Call

Phreak

ReteOO• Node Sharing • Alpha Indexing • Beta Indexing • Tree based graphs • Modify-in-place • Property Reactive • Sub-networks • Backward Chaining • Lazy Truth Maintenance • Heap Based Agenda Queue • Dynamic Rules

Phreak• Lazy Evaluation • Isolated Rule Evaluation • Incremental Goal Oriented Evaluations • Set Oriented Propagations

• Set Oriented Match (Future) • Stack baed evaluations, with pause and resume

Layered Memory

Bit Masks and Linking

Bit Masks and Linking

Bit Masks and Linking

A

D

R1

Not B

Not

C

R2

R1 = A not ( B not ( C ) ) DR2 = A B C

Thread Safety / State Machine

State Transition

INACTIVE

FIRE_ALL_RULES FIRE_UNTIL_HALT

HALTING

EXECUTE_TASK

fireAllRules fireUntilHalt

at rest

halt halt

executeTask

fireAllRules() fireUntilHalt()

sync(engineLock)

isFiring() == trueTrue

False

waitAndEnter(FIRE_ALL_RULES)

fireLoop(RestHandler.FIRE_ALL_RULES)

fireAllRules()

sync(engineLock)

state=FIRE_UNTIL_HALTTrue

False

waitAndEnter(FIRE_UNTIL_HALT)

fireLoop(RestHandler. FIRE_UNTIL_HALT)

fireUntilHalt()

fireLoopLoop

fireLoop(restHandler)

head=takeAll()returnedFireCount=0loop=true

flush(head)

head != null

True

head=takeAll()

returnedFireCount = fireNextItem()

False

isFiring() == true

true

false

atRest(head, returnedFireCount

head=handleRest(restHandler)

isFiring() == true

immediateHalt()

true false

flush(head)

FIRE_UNTIL_HALT FIRE_ALL_RULES

sync(queueLock)

RestHander.FIRE_UNTIL_HALT

head = takeAll()

queueLock.wait()

head == null &&state == FIRE_UNTIL_HALT

true

return head

false

head = takeAll()

The thread will sleep until the addEntry notifies it to wake up

sync(engineLock)

RestHander.FIRE_ALL_RULES

head = takeAll()

state = INACTIVE

head == null

true

return head

false

WaitAndEnter immediateHalt

state!=INACTIVE

True

true

engineLock.wait()

state = newState

waitAndEnter(newState)

The thread will sleep until the immediateHalt is called which calls the engineLock.notify. Note this method must always be called from inside of a sync(engineLock) block.

immedateHalt()

sync(engineLock)

state!=INACTIVE

false

true

state = INACTIVE

engineLock.notify()This will wake any threads currently waiting in the waitAndEnter method.

Multicore Scalability

Immutable Use Cases

OOPath

Reactive List Comprehensionrule R when\n" + Adult( $child: /children )then\n" + list.add( $child.getName() );end

Nested Reactive List Comprehensionrule R when\n" + Adult( $child: /children )then\n" + list.add( $child.getName() );end

rule R when\n" + Man( $toy: /wife/children/toys )then\n" + list.add( $toy.getName() );end

No Comprehension or Reactivity

rule R when\n" + Man( $toy: /wife/children/toys )then\n" + list.add( $toy.getName() );end

rule R when\n" + Man( $toy: /wife/children.toys )then\n" + list.add( $toy.getName() );end

Constraints

rule R when\n" + Man( $toy: /wife/children{age > 10}/toys )then\n" + list.add( $toy.getName() );end

rule R when\n" + Man( $toy: /wife/children{age > 10, name.length > 5}.toys )then\n" + list.add( $toy.getName() );end

Non Reactivity

rule R when\n" + Man( $toy: ?/wife/children{age > 10}/toys )then\n" + list.add( $toy.getName() );end

rule R when\n" + Man( $toy: /wife/children{age > 10}?/toys )then\n" + list.add( $toy.getName() );end

Casting and Type Filtering

rule R when\n" + Man( $name: /wife/children{ #BabyGirl, favoriteDollName.startsWith(\”A\”) }.name )then\n" + list.add( $name );end

Back Referencing

rule R when\n" + Man( $toy: /wife/children/toys{ name.length == ../name.length } )then\n" + list.add( $toy.getName() );end

Out of Pattern Usage

query isContainedIn( Thing $x, Thing $y ) $y := /$x/childrenor ( $z := /$x/children and isContainedIn( $z, $y; ) )end

Pojo Rules

DRL Fire Alarm Example

Pojo-Rules Fire Alarm Example

DRL Fire Alarm Example

Pojo-Rules Fire Alarm Example

DRLX

DRLX

• Java super-set • Java pre-processing using Antlr Java8.g

• Similar approach to pizza language that gave us generics • Will output pojo-rules underneath • But be more succinct and friendly that poco-rules