JBoss Business Rules Management System (BRMS) Primer

Embed Size (px)

Citation preview

JBoss BRMS Primer Business Rules Management System (BRMS)

Eric D. SchabellJBoss Technology Evangelist

t: @ericschabell / e: [email protected]

Agenda

Introduction

JBoss BRMS Biz Rules

Biz Process Management

Biz Events

Demo

Questions

Integrated Intelligent Business Platform

JBoss Enteprise BRMS (new in 2009)Enables critical business rules to be managed in a more centralized manner (e.g. Insurance = policy risk assess and pricing; Heathcare = claims processing annual regulatory changes)Avoids need to otherwise re-code business rules redundantly in multiple applicationsLeverages JBoss Rules execution engine which has been available for yearsAdds new browser-based Rules Mgmt app, enabling business users to participate in the review, editing, and maintenance of business rule changesAlso adds Repository to provide version management of multiple sets of business rulesSupports the deployment of business rules to JBoss middleware platforms and non-JBoss runtime environments

Product Support Configurations

JBoss Enteprise BRMS (new in 2009)Enables critical business rules to be managed in a more centralized manner (e.g. Insurance = policy risk assess and pricing; Heathcare = claims processing annual regulatory changes)Avoids need to otherwise re-code business rules redundantly in multiple applicationsLeverages JBoss Rules execution engine which has been available for yearsAdds new browser-based Rules Mgmt app, enabling business users to participate in the review, editing, and maintenance of business rule changesAlso adds Repository to provide version management of multiple sets of business rulesSupports the deployment of business rules to JBoss middleware platforms and non-JBoss runtime environments

Choice of Tools

Business User Friendly Web Based

Developer Friendly IDE Based

JBoss Enteprise BRMS (new in 2009)Enables critical business rules to be managed in a more centralized manner (e.g. Insurance = policy risk assess and pricing; Heathcare = claims processing annual regulatory changes)Avoids need to otherwise re-code business rules redundantly in multiple applicationsLeverages JBoss Rules execution engine which has been available for yearsAdds new browser-based Rules Mgmt app, enabling business users to participate in the review, editing, and maintenance of business rule changesAlso adds Repository to provide version management of multiple sets of business rulesSupports the deployment of business rules to JBoss middleware platforms and non-JBoss runtime environments

Knowledge Management

JBoss Enteprise BRMS (new in 2009)Enables critical business rules to be managed in a more centralized manner (e.g. Insurance = policy risk assess and pricing; Heathcare = claims processing annual regulatory changes)Avoids need to otherwise re-code business rules redundantly in multiple applicationsLeverages JBoss Rules execution engine which has been available for yearsAdds new browser-based Rules Mgmt app, enabling business users to participate in the review, editing, and maintenance of business rule changesAlso adds Repository to provide version management of multiple sets of business rulesSupports the deployment of business rules to JBoss middleware platforms and non-JBoss runtime environments

Repository

Central Knowledge / Asset Repository

Store Models, Process Def, Rule Def, Images, Anything Else

Can store and manage any kind of assets

Based on JCR 2.0

Version Control

Can also be accessed by WebDAV and HTTP

New Access through REST

Further persists to RDBMS

JBoss Enteprise BRMS (new in 2009)Enables critical business rules to be managed in a more centralized manner (e.g. Insurance = policy risk assess and pricing; Heathcare = claims processing annual regulatory changes)Avoids need to otherwise re-code business rules redundantly in multiple applicationsLeverages JBoss Rules execution engine which has been available for yearsAdds new browser-based Rules Mgmt app, enabling business users to participate in the review, editing, and maintenance of business rule changesAlso adds Repository to provide version management of multiple sets of business rulesSupports the deployment of business rules to JBoss middleware platforms and non-JBoss runtime environments

BRMS (+jBPM 5) Interoperability with SOA -P

SOA-P is a certified Container

Integration of jBPM 5 with ESB in 5.3

JBoss Enteprise BRMS (new in 2009)Enables critical business rules to be managed in a more centralized manner (e.g. Insurance = policy risk assess and pricing; Heathcare = claims processing annual regulatory changes)Avoids need to otherwise re-code business rules redundantly in multiple applicationsLeverages JBoss Rules execution engine which has been available for yearsAdds new browser-based Rules Mgmt app, enabling business users to participate in the review, editing, and maintenance of business rule changesAlso adds Repository to provide version management of multiple sets of business rulesSupports the deployment of business rules to JBoss middleware platforms and non-JBoss runtime environments

Operations Management

Pluggable to JON

Monitor long running sessions

Monitor knowledgebase params for each KB

View list of running sessions

List of active rules in sessions

For each rule session params

Session params like No. of facts

Total firing time

Avg firing time

Total activations

JBoss Enteprise BRMS (new in 2009)Enables critical business rules to be managed in a more centralized manner (e.g. Insurance = policy risk assess and pricing; Heathcare = claims processing annual regulatory changes)Avoids need to otherwise re-code business rules redundantly in multiple applicationsLeverages JBoss Rules execution engine which has been available for yearsAdds new browser-based Rules Mgmt app, enabling business users to participate in the review, editing, and maintenance of business rule changesAlso adds Repository to provide version management of multiple sets of business rulesSupports the deployment of business rules to JBoss middleware platforms and non-JBoss runtime environments

Embed Guvnor Editors in Custom Applications

Embed Any editor in your app

Guvnor webapp should be running

BRL Editor mode no repo saving

Existing Asset Editor mode save to repo

New Asset Editor mode

Use JavaScript to interact with editor

Use Http to interact with Guvnor app

JBoss Enteprise BRMS (new in 2009)Enables critical business rules to be managed in a more centralized manner (e.g. Insurance = policy risk assess and pricing; Heathcare = claims processing annual regulatory changes)Avoids need to otherwise re-code business rules redundantly in multiple applicationsLeverages JBoss Rules execution engine which has been available for yearsAdds new browser-based Rules Mgmt app, enabling business users to participate in the review, editing, and maintenance of business rule changesAlso adds Repository to provide version management of multiple sets of business rulesSupports the deployment of business rules to JBoss middleware platforms and non-JBoss runtime environments

Agenda

Introduction

JBoss BRMS Biz Rules

Biz Process Management

Biz Events

Demo

Questions

JBoss BRMS
What is a rule?

In short, a rule is an premise and conclusionIf it is raining, then the ground must be wet

A rule is made of conditions and actions. When all the conditions are met, a rule may fire.

The conditions are collectively referred to as the LHS (left hand side) and the actions are referred to as the RHS (right hand side, or consequence).

A rule operates on facts (data). In our case, these facts are instances of objects in our application.

JBoss BRMS
What is inferencing?

We want to take all of our data (facts) and combine it with our knowledge (rules) and come up with some conclusions (inferencing)

JBoss BRMS
What is inferencing?

We want to take all of our data (facts) and combine it with our knowledge (rules) and come up with some conclusions (inferencing)

JBoss BRMS
What is inferencing?

We want to take all of our data (facts) and combine it with our knowledge (rules) and come up with some conclusions (inferencing)

JBoss BRMS
What is inferencing?

We want to take all of our data (facts) and combine it with our knowledge (rules) and come up with some conclusions (inferencing)

JBoss BRMS
What is inferencing?

We want to take all of our data (facts) and combine it with our knowledge (rules) and come up with some conclusions (inferencing)

Rules in actionGolfing Configuration Example

There are four Golfers standing at a tee, in a line from left to right:

The golfer to Freds immediate right is wearing blue pants

Joe is second in line

Bob is wearing plaid pants

Tom isnt in position one or four, and he isnt wearing the orange pants

Golfing Configuration Example

Create all possible combinationsString[] names = new String[]{"Fred", "Joe", "Bob", "Tom"};String[] colors = new String[]{"red", "blue", "plaid,"orange" };

int[] positions = new int[] {00, 2, 3, 4};

for ( int n = 0; n < names.length; n++ ) { for ( int c = 0; c < colors.length; c++ ) { for ( int p = 0; p < positions.length; p++ ) { new Golfer(names[n], colors[c], positions[p]); } } }

There is a golfer named Fred

// There is a golfer named Fred fred : Golfer( name == "Fred" )

Fred

Joe is second in line

// Joe is in position 2 joe : Golfer(name == "Joe,position == 2 && != fred.position,color != fred.color )Joe

Bob is wearing plaid pants

// Bob is wearing plaid pants bob : Golfer(name == "Bob", position!= fred.position && != joe.position,color == "plaid" && != fred.color && != joe.color )Bob

Tom isnt in position one or four, and he isnt wearing the orange pants

// Tom isn't in position 1 or 4// and isn't wearing orangetom : Golfer(name == "Tom", position not in (1, 4, fred.position,joe.position, bob.position),color not in ("orange", "blue", fred.color, joe.color, bob.color))

Tom

The golfer to Fred's immediate right is wearing blue pants

// The golfer to Fred's immediate right// is wearing blue pantsGolfer(position == (fred.getPosition() + 1), color == "blue", this in ( joe, bob, tom ))

Fred's neighbor

ResultsSystem.out.println( "Fred's position is " +fred.getPosition() + " and his color is " +fred.getColor() ); System.out.println( "Joe's position is " + joe.getPosition() + " and his color is " +joe.getColor() ); System.out.println( "Bob's position is " + bob.getPosition() + " and his color is " +bob.getColor() ); System.out.println( "Tom's position is " +tom.getPosition() + " and his color is " +tom.getColor() );

Fred 1 orangeJoe 2 blueBob 4 plaidTom 3 red

Rules technology provides a new way to create business applications, where business logic is declared in a rule language, instead of a traditional procedural language.

Rule engines are good for solving complex problems that don't have any other way to solve.

Business Rule Management Systems can be used to manage thousands of rules.

Conclusions

JBoss BRMS
Inference Engine

The brain of a Production Rule System is an Inference Engine which matches facts against Production Rules.

When matches are found, the rules actions are fired.

Actions most often change the state of the facts, or perform some external action on the application.

Conceptual example

KnowledgeBaseStateful / StatelessKnowledgeSessionRule package(artifacts)

Agenda

Example: real BPM

KnowledgeBaseStatefulKnowledgeSessionProcessDefinition

ProcessInstance

AgendaRuleRuleRuleRuleRuleFactFactFactFactFactWorkingMemory3. Assert Facts

RuleBaseFactFactFactFactFactRuleRuleRuleRuleRule

2. Create4. Fire All Rules(5) activation
-> consequence1.Parse DRLActivationRuleFactActivationRuleFactFactJBoss BRMS
How it Works

Rules Engine

Support Inference

Implements ReteOO algorithm

Embeddable, lightweight

Highly performant

Scalable and most stable

Supports Declarative Programming

JBoss Enteprise BRMS (new in 2009)Enables critical business rules to be managed in a more centralized manner (e.g. Insurance = policy risk assess and pricing; Heathcare = claims processing annual regulatory changes)Avoids need to otherwise re-code business rules redundantly in multiple applicationsLeverages JBoss Rules execution engine which has been available for yearsAdds new browser-based Rules Mgmt app, enabling business users to participate in the review, editing, and maintenance of business rule changesAlso adds Repository to provide version management of multiple sets of business rulesSupports the deployment of business rules to JBoss middleware platforms and non-JBoss runtime environments

Rule Authoring Choices

JBoss Enteprise BRMS (new in 2009)Enables critical business rules to be managed in a more centralized manner (e.g. Insurance = policy risk assess and pricing; Heathcare = claims processing annual regulatory changes)Avoids need to otherwise re-code business rules redundantly in multiple applicationsLeverages JBoss Rules execution engine which has been available for yearsAdds new browser-based Rules Mgmt app, enabling business users to participate in the review, editing, and maintenance of business rule changesAlso adds Repository to provide version management of multiple sets of business rulesSupports the deployment of business rules to JBoss middleware platforms and non-JBoss runtime environments

All new Decision Table: Business User Friendly

Intuitive and powerful interface for any users

Ability to visually create large set of business rules

Quick validation of rules

Verify coverage for all conditions

JBoss Enteprise BRMS (new in 2009)Enables critical business rules to be managed in a more centralized manner (e.g. Insurance = policy risk assess and pricing; Heathcare = claims processing annual regulatory changes)Avoids need to otherwise re-code business rules redundantly in multiple applicationsLeverages JBoss Rules execution engine which has been available for yearsAdds new browser-based Rules Mgmt app, enabling business users to participate in the review, editing, and maintenance of business rule changesAlso adds Repository to provide version management of multiple sets of business rulesSupports the deployment of business rules to JBoss middleware platforms and non-JBoss runtime environments

Decision Tables Supported Categorization

Multi hit, all hit

Conditions are not mutually exclusive

All matching rules executed

Multi hit, first hit

Conditions are not mutually exclusive.

First matching rule executes

Single hit

Exactly One rule fires

No ambiguity

JBoss Enteprise BRMS (new in 2009)Enables critical business rules to be managed in a more centralized manner (e.g. Insurance = policy risk assess and pricing; Heathcare = claims processing annual regulatory changes)Avoids need to otherwise re-code business rules redundantly in multiple applicationsLeverages JBoss Rules execution engine which has been available for yearsAdds new browser-based Rules Mgmt app, enabling business users to participate in the review, editing, and maintenance of business rule changesAlso adds Repository to provide version management of multiple sets of business rulesSupports the deployment of business rules to JBoss middleware platforms and non-JBoss runtime environments

Rule Templates

Loading Template Data

JBoss Enteprise BRMS (new in 2009)Enables critical business rules to be managed in a more centralized manner (e.g. Insurance = policy risk assess and pricing; Heathcare = claims processing annual regulatory changes)Avoids need to otherwise re-code business rules redundantly in multiple applicationsLeverages JBoss Rules execution engine which has been available for yearsAdds new browser-based Rules Mgmt app, enabling business users to participate in the review, editing, and maintenance of business rule changesAlso adds Repository to provide version management of multiple sets of business rulesSupports the deployment of business rules to JBoss middleware platforms and non-JBoss runtime environments

BRMS 5.3 Other New Features

Backward Chaining Full Support

Lazy Truth Maintenance enabled automagically when needed

Free form expression in constraints: Enables writing complex expressions and nested accessors

Person( age * 2 > $anotherPersonsAge + 2 ) // mathematical expressions Person( addresses["home"].streetName.startsWith( "High Park" ) ) // method calls and collections simplified syntax Person( isAdult() ) // boolean expression without relational operator Cheese( ) from [ $stilton, $brie, $provolone ] // inline list creation and iterationPerformance enhancements

Optimized parser enhances

Modularity enabled for OSGI set up

A rule logically inserts an object

When the rule is no longer true, the object is retracted.

when $p : Person( age < 16 )then logicalInsert( new IsChild( $p ) )endwhen $p : Person( age >= 16 )then logicalInsert( new IsAdult( $p ) )End

ule "Issue Child Bus Pass"when $p : Person( ) IsChild( person =$p )then logicalInsert(new ChildBusPass( $p ) );endrule "Issue Adult Bus Pass"when $p : Person( age >= 16 ) IsAdult( person =$p )then logicalInsert(new AdultBusPass( $p ) );End

rule "Issue Child Bus Pass"when $p : Person( ) not( ChildBusPass( person == $p ) )then requestChildBusPass( $p );end

de-couples the logicMaintains the truth by
automatically retractingThe truth maintenance cascades

Developer Perspective

JBoss Developer Studio
Fact ModelDSL Template

Check-In Artifacts to Repository

JBoss BRMS Web Manager
Use Facts & DSL
to create Business Rules

JBoss BRMS Web Manager
Create Test Scenarios

JBoss BRMS Web Manager
Create Package

DeploymentJ2SEEAP-WS,WAR,EARSOA-P,
Mediated Services

Eclipse Developer Perspective

Debugging

Debug Views

New rule perspective to configure IDE for rules as needed

Guided Rule Editor (Eclipse)

Eclipse Guided Editor

Agenda

Introduction

JBoss BRMS Biz Rules

Biz Process Management

Biz Events

Demo

Questions

Process Management Functions and Roles

Typical Business Process Lifecycle

Improve

Process Modeling

Web Based Modeling Tools

IDE Based Modeling Tools

Create BPMN2 Process Definition

Common Design Time Repository Store, Manage, Version

Create Process Definitions, Validate, Package, Deploy

Develop User forms, integrate other Business Assets (rules etc)

Import BPMN2 Definitions

Process Designer Highlights

Fully Integrated with BRMS Guvnor On-stop business modeling tool

Rich set of BPMN2 elements Drag and drop on canvas

Domain Specific Nodes Add your own tasks to the list

Generate PDF or PNG documents of process definition

Embeddable Designer Allows adopting designer in your own tool

Process Designer Highlights User Forms

Create Task Forms and Process Forms in the designer

Forms necessary for Workflow kick off and Human task inputs

These forms are used when process instance is created Business Central

Inline editing within the process definition

Process Designer Highlights Visual Process Validation

Visually validate the process definition before packaging

Process Deployment Loading Process Definition

Load Definitions through Business Central

Use Knowledge API to programmatically load

Process Execution - Process Engine Highlights

Lightweight, Embeddable, Extensible

Manages State Transition

Native BPMN2 Execution

Use out of the box Persistence and Transaction

Or Plugin your Own Persistence and Transaction

Spring, Camel and OSGi Integration

Process Execution - Task Server Highlights

Independent Task Management Server

Manages Lifecycle of Human Tasks Creation, Claim, Completion etc

Support for Assignment, Delegation, deadlines, calendar integration, internationalization etc.

Manages its own state persistence different from process data persistence

WS-HT Based

Accessible both by Synchronous and Asynchronous communication

HornetQ is the default transport.

Works with Apache Mina

Accessible through REST interface

Process Monitoring Business Central

One-stop Web Based Center for Managing Business Operations

Manage and Monitor Business Processes

Manage Human Tasks

Plug your own reporting tool and create reports

Role based authentication configurable to any JaaS / LDAP

REST Interface for programmatic access to functions

Business Central Monitoring Processes

View all process definitions that are installed in knowledgebase

Instantiate a process instanceInline input Process Input form

Manage running processes Start, Terminate, Delete, Signal

Inspect State of a Process Instance and Execution Details

Business Central Managing Tasks

View Assigned (personal) tasks and Un-assigned (group) tasks

Claim a Task, Execute a Task, Release a Task

Complete inline user task forms

Process Monitoring Reporting

Powerful Knowledge APIs, REST interface

Leverage power of CEP for realtime reporting

Easy to integrate popular 3rd party reporting solutions

Will supply how to guides

Placeholder for dashboard. No out of the box reporting in the product

Agenda

Introduction

JBoss BRMS Biz Rules

Biz Process Management

Biz Events

Demo

Questions

Event Processor

CEP Engine enables -Event Detection: Cloud mode and Stream mode

Temporal Reasoning (correlation) reason over aggregation

Abstraction Compose complex events and reason over them

CEP Engine Supports:Event Semantics (point in time and interval) as first class citizen analogous to rule semantics

Support both point in time (as interval with zero duration) and interval semantics

Ability to apply temporal constraints

Use Session clocks: Support Realtime (system) clock, Psedo Clock (controlled by application)

Sliding window support

Ability to scale to high volume of events

JBoss Enteprise BRMS (new in 2009)Enables critical business rules to be managed in a more centralized manner (e.g. Insurance = policy risk assess and pricing; Heathcare = claims processing annual regulatory changes)Avoids need to otherwise re-code business rules redundantly in multiple applicationsLeverages JBoss Rules execution engine which has been available for yearsAdds new browser-based Rules Mgmt app, enabling business users to participate in the review, editing, and maintenance of business rule changesAlso adds Repository to provide version management of multiple sets of business rulesSupports the deployment of business rules to JBoss middleware platforms and non-JBoss runtime environments

CEP Modes

Cloud Mode

Stream Mode

Default Mode All facts and events are loaded before reasoning

Many to many pattern matching by the engine

No notion of flow of time, no clock synchronization

Ordering is not required

Event lifecycle managed by user

Sliding window is not needed

Events must be time-ordered

Engine synchronizes between streams using session clock

Engine applies the notion of flow

Engine manages the event lifecycle

Sliding window option could be used

Negative patterns could be used. Ex. Fire detected, no sprinkler turned on in 10 sec sound alarm

JBoss Enteprise BRMS (new in 2009)Enables critical business rules to be managed in a more centralized manner (e.g. Insurance = policy risk assess and pricing; Heathcare = claims processing annual regulatory changes)Avoids need to otherwise re-code business rules redundantly in multiple applicationsLeverages JBoss Rules execution engine which has been available for yearsAdds new browser-based Rules Mgmt app, enabling business users to participate in the review, editing, and maintenance of business rule changesAlso adds Repository to provide version management of multiple sets of business rulesSupports the deployment of business rules to JBoss middleware platforms and non-JBoss runtime environments

Temporal Relationships

Event A before Event B

Event A meets Event B

Event A overlaps Event B

Event A finishes Event B

Event A includes Event B

Event A starts Event B

Event A coincides Event B

Event A after Event B

Event A metBy Event B

Event A overlapedBy Event B

Event A finishedBy Event B

Event A during Event B

Event A finishes Event B

when Shipment( $pickupTime : scheduledPickupTime ) not ShipmentPickup( this before $pickupTime )then // shipment not picked up... Action required.endrule Shipment not picked up in time

Temporal Relationship

13 Operators are Supported

JBoss Enteprise BRMS (new in 2009)Enables critical business rules to be managed in a more centralized manner (e.g. Insurance = policy risk assess and pricing; Heathcare = claims processing annual regulatory changes)Avoids need to otherwise re-code business rules redundantly in multiple applicationsLeverages JBoss Rules execution engine which has been available for yearsAdds new browser-based Rules Mgmt app, enabling business users to participate in the review, editing, and maintenance of business rule changesAlso adds Repository to provide version management of multiple sets of business rulesSupports the deployment of business rules to JBoss middleware platforms and non-JBoss runtime environments

CEP Sliding Windows

Sliding window 1

Sliding window 2

Joined window

Sliding Time Window- Reason Over events occurring next set time duration

Sliding Length Window- Reason Over set number of events occuring

rule "Sound the alarm in case temperature rises above threshold"when TemperatureThreshold( $max : max ) Number( doubleValue > $max ) from accumulate( SensorReading( $temp : temperature ) over window:time( 10m ), average( $temp ) )then // sound the alarmend

rule "Sound the alarm in case temperature rises above threshold"when TemperatureThreshold( $max : max ) Number( doubleValue > $max ) from accumulate( SensorReading( $temp : temperature ) over window:length( 100 ), average( $temp ) )then // sound the alarmend

Example: Raise alarm if avg temp reading from sensor over last 10m is above the threshold

Example: Raise alarm if avg temp from last 100 sensor readings is above the threshold

JBoss Enteprise BRMS (new in 2009)Enables critical business rules to be managed in a more centralized manner (e.g. Insurance = policy risk assess and pricing; Heathcare = claims processing annual regulatory changes)Avoids need to otherwise re-code business rules redundantly in multiple applicationsLeverages JBoss Rules execution engine which has been available for yearsAdds new browser-based Rules Mgmt app, enabling business users to participate in the review, editing, and maintenance of business rule changesAlso adds Repository to provide version management of multiple sets of business rulesSupports the deployment of business rules to JBoss middleware platforms and non-JBoss runtime environments

Apply CEP operators for Rules

Apply 13 operators available

Define sliding time window or length

JBoss Enteprise BRMS (new in 2009)Enables critical business rules to be managed in a more centralized manner (e.g. Insurance = policy risk assess and pricing; Heathcare = claims processing annual regulatory changes)Avoids need to otherwise re-code business rules redundantly in multiple applicationsLeverages JBoss Rules execution engine which has been available for yearsAdds new browser-based Rules Mgmt app, enabling business users to participate in the review, editing, and maintenance of business rule changesAlso adds Repository to provide version management of multiple sets of business rulesSupports the deployment of business rules to JBoss middleware platforms and non-JBoss runtime environments

Demo

https://github.com/eschabell/brms-customer-evaluation-demo

https://github.com/eschabell/brms-rewards-demo

JBoss BRMS, the future is now

Click to edit the title text format

Click to edit the outline text format

Click to edit the outline text formatSecond Outline LevelThird Outline LevelFourth Outline LevelFifth Outline LevelSixth Outline LevelSeventh Outline LevelEighth Outline LevelNinth Outline Level

Click to edit the title text format

Click to edit the outline text format

Click to edit the title text format

Click to edit the outline text format

Click to edit the title text format

Click to edit the outline text format

RED HAT INTERNAL ONLY

Click to edit the title text format

Click to edit the outline text format

Red Hat Confidential Partner NDA & Approval from Red Hat Partner Manager Required

Click to edit the outline text formatSecond Outline LevelThird Outline Level