drools introduction

11
- LAKSHMI PRATYUSHA KUPPA DROOLS 1

Upload: lakshmi1693

Post on 13-Apr-2017

244 views

Category:

Education


0 download

TRANSCRIPT

Page 1: Drools Introduction

- L A K S H M I P R A T Y U S H A K U P P A

DROOLS

1

Page 2: Drools Introduction

2

CONTEXT

• Java enterprise level application can be split into three parts −• User Interface• Service layer• Business layer

• Drool is a standard way to handle the business layer.• It is a collection of tools that separates logic and

data within business processes. 

Page 3: Drools Introduction

3

WHAT IS DROOLS ?

• Drools is a Business Logic integration Platform (BLiP).• It is written in Java.• It is an open source project that is backed by

JBoss and Red Hat, Inc.

Page 4: Drools Introduction

4

ADVANTAGES

• Declarative Programming• Rules are written in less complex language.

• Speed and Scalability• One can add new rules without having to modify the

existing rules and these are very quickly processed.• Centralization of Knowledge• By using Rules, you create a repository of knowledge (a

knowledge base) which is executable. • Tool Integration• Tools such as Eclipse provide ways to edit and manage

rules and get immediate feedback, validation, and content assistance.

Page 5: Drools Introduction

5

KNOWLEDGE BASE

• Interface that manages a collection of rules, processes, and internal type.• The main purpose of Knowledge Base is to store

and reuse them because their creation is expensive.• Knowledge Base provides methods for creating

knowledge sessions.

Page 6: Drools Introduction

6

KNOWLEDGE SESSIONS

• It is the main interface for interacting with the Drools Engine. • The knowledge session can be of two types:• Stateless Knowledge Session• Stateful Knowledge Session.

Page 7: Drools Introduction

7

STATELESS KNOWLEDGE SESSION• It is a stateless session that forms the simplest use case,

not utilizing inference.• It can be called like a function, passing it some data and

then receiving some results back.• Examples:• Validation• Is this person eligible for a mortgage?

• Calculation• Compute a mortgage premium.

• Routing and Filtering• Filter incoming messages, such as emails, into folders.• Send incoming messages to a destination

Page 8: Drools Introduction

8

STATEFUL KNOWLEDGE SESSION

• Stateful sessions are longer lived and allow iterative changes over time. • Some common use cases for Stateful sessions

include:• Monitoring• Stock market monitoring and analysis for semi-automatic buying.

• Diagnostics• Fault finding, medical diagnostics

• Logistics• Parcel tracking and delivery provisioning

Page 9: Drools Introduction

9

KNOWLEDGE BUILDER

• The interface is responsible for building a KnowledgePackage from knowledge definitions (rules, processes, types).

Page 10: Drools Introduction

10

EXAMPLE

The objects that the rule file accesses should be added to the session.

A kmodule.xml file defining in a declaratively way the KieBases and KieSessions that can be created from it.

Page 11: Drools Introduction

11

RULE FILE