Click here to load reader

BRMS Platform 5.0 JBoss Rules 5 JBoss Enterprise fileJBoss Enterprise BRMS Platform 5.0 JBoss Rules 5 Reference Guide Your complete guide to using JBoss Rules 5 with the JBoss Enterprise

  • View
    221

  • Download
    0

Embed Size (px)

Text of BRMS Platform 5.0 JBoss Rules 5 JBoss Enterprise fileJBoss Enterprise BRMS Platform 5.0 JBoss Rules...

  • JBoss EnterpriseBRMS Platform 5.0

    JBoss Rules 5Reference Guide

    Your complete guide to using JBoss Rules5 with the JBoss Enterprise BRMS Platform.

    Mark Proctor

    Michael Neale

    Edson Tirelli

  • JBoss Rules 5 Reference Guide

    JBoss Enterprise BRMS Platform 5.0 JBoss Rules 5 ReferenceGuideYour complete guide to using JBoss Rules 5 with the JBossEnterprise BRMS Platform.Edition 1

    Author Mark ProctorAuthor Michael NealeAuthor Edson TirelliEditor Darrin Mison [email protected]

    Copyright 2008 Red Hat, Inc.. This material may only be distributed subject to the terms andconditions set forth in the Open Publication License, V1.0 or later (the latest version of the OPL ispresently available at http://www.opencontent.org/openpub/).

    Red Hat and the Red Hat "Shadow Man" logo are registered trademarks of Red Hat, Inc. in the UnitedStates and other countries.

    All other trademarks referenced herein are the property of their respective owners.

    1801 Varsity Drive Raleigh, NC 27606-2072 USA Phone: +1 919 754 3700 Phone: 888 733 4281 Fax: +1 919 754 3701 PO Box 13588 Research Triangle Park, NC 27709 USA

    This guide contains a complete overview and detailed reference for JBoss Rules 5. It is intended foruse with the JBoss Enterprise BRMS Platform.

    mailto:[email protected]://www.opencontent.org/openpub/

  • iii

    Preface vii1. Document Conventions .................................................................................................. vii

    1.1. Typographic Conventions .................................................................................... vii1.2. Pull-quote Conventions ....................................................................................... viii1.3. Notes and Warnings ............................................................................................ ix

    2. We Need Feedback! ....................................................................................................... x

    1. The Rule Engine 11.1. What is a Rule Engine? ............................................................................................... 1

    1.1.1. Introduction and Background .............................................................................. 11.2. Why use a Rule Engine? .............................................................................................. 4

    1.2.1. Advantages of a Rule Engine ............................................................................. 51.2.2. When should you use a Rule Engine? ................................................................ 61.2.3. When not to use a Rule Engine ......................................................................... 71.2.4. Strong and Loose Coupling ................................................................................ 7

    2. Quick Start 92.1. The Basics .................................................................................................................. 9

    2.1.1. Stateless Knowledge Session ............................................................................ 92.1.2. Stateful Knowledge Session ............................................................................. 12

    2.2. A Little Theory ........................................................................................................... 152.2.1. Methods versus Rules ..................................................................................... 152.2.2. Cross Products ................................................................................................ 162.2.3. Activations, Agenda and Conflict Sets ............................................................... 17

    2.3. More on building and deploying .................................................................................. 212.3.1. Adding Rules using Changesets ....................................................................... 212.3.2. Knowledge Agent ............................................................................................ 22

    3. User Guide 233.1. Building ...................................................................................................................... 23

    3.1.1. Building using Code ......................................................................................... 243.1.2. Building using Configuration and the ChangeSet XML ........................................ 26

    3.2. Deploying ................................................................................................................... 283.2.1. KnowledgePackage and Knowledge Definitions ............................................... 283.2.2. KnowledgeBase ............................................................................................... 293.2.3. In-Process Building and Deployment ................................................................. 303.2.4. Building and Deployment in Separate Processes ............................................... 313.2.5. StatefulknowledgeSessions and KnowledgeBase Modifications ........................... 313.2.6. KnowledgeAgent .............................................................................................. 32

    3.3. Running ..................................................................................................................... 353.3.1. KnowledgeBase ............................................................................................... 353.3.2. StatefulKnowledgeSession ............................................................................... 353.3.3. KnowledgeRuntime .......................................................................................... 363.3.4. Agenda ........................................................................................................... 433.3.5. Event Model .................................................................................................... 463.3.6. KnowledgeRuntimeLogger ................................................................................ 483.3.7. StatelessKnowledgeSession ............................................................................. 493.3.8. Pipeline ........................................................................................................... 533.3.9. Commands and the CommandExecutor ............................................................ 603.3.10. Marshaling ..................................................................................................... 693.3.11. Persistence and Transactions ......................................................................... 71

    4. The Rule Language 75

  • JBoss Rules 5 Reference Guide

    iv

    4.1. Overview .................................................................................................................... 754.1.1. A rule file ........................................................................................................ 754.1.2. What makes a rule .......................................................................................... 75

    4.2. Keywords ................................................................................................................... 764.3. Comments ................................................................................................................. 77

    4.3.1. Single line comment ........................................................................................ 774.3.2. Multi-line comment ........................................................................................... 77

    4.4. Error Messages ........................................................................................................ 784.4.1. Message format ............................................................................................... 784.4.2. Error Messages Description ............................................................................. 784.4.3. Other Messages .............................................................................................. 82

    4.5. Package .................................................................................................................... 824.5.1. import ............................................................................................................. 834.5.2. expander ......................................................................................................... 834.5.3. global .............................................................................................................. 84

    4.6. Function ..................................................................................................................... 854.7. Type Declaration ........................................................................................................ 86

    4.7.1. Declaring New Types ....................................................................................... 874.7.2. Declaring Metadata .......................................................................................... 894.7.3. Declaring Metadata for Existing Types .........................................

Search related