Unit objectives
After completing this unit, you should be able to:
●
Describe the advantages to externalizing business
rules as business rule services
●
Explain how the SCA programming model supports the
development of business rule services
●
Define a business rule
●
Explain rule sets, decision tables and rule groups
●
Identify situations where it is appropriate to use a rule
set or a decision table
What is a business rule?
●
A business rule is an If-Then business decision.
If discount == 0.10,
Then total = total – (total * discount)
●
The job of a business rule is to:
– Evaluate an input (if-then)
– Change a state
Business rules – examples
●
Rent-a-car corporate discounts
– Able to change discount amounts during peak dates and times
●
Insurance agency
– Ability to invoke a process for an insurance claim that happened in the past when the claim rules were different
●
Updating the Web site of a company
– Schedule specific dates that a Web site will update to the next development version without the knowledge of the end user
Motivation for using business rules in SOA
●
Loose-coupling between business rules and service
management functions.
• For example, ESB mediations are decoupled from business rule logic.
●
They allow the specification of the business logic in a simple
form, easily understood by business analysts.
– Logic is specified as either:
• A sequence of if-test-then-actions clauses.
• A simple decision tree.
– Rule changes can be made without the intervention of expensive IT personnel.
●
Details of business rules change frequently.
– While the structure of the rules will be specified using the WebSphere Integration Developer tooling, elements can be added or customized using Web tools (coming up).
Support for business rules in WebSphere Process
Server and WebSphere Integration Developer
Service Components Supporting Services SOA Core Business processes Human tasks Business state machines Business Rules SCA Business
objects Common eventinfrastructure
WebSphere Application Server ND (J2EE runtime) Interface
Roles, rule templates and the Business Rules
Manager
Business Analyst Role
Business Analyst Role
Developer Role
Developer Role More technical skills More business skills
Tools used Business Rules Manager Web Tool WebSphere Integration Developer Role tasks
• Discusses desired changes with Developer and implements business rule changes.
• More aware of business and customer demand changes.
• Codes editable business rules. • These rules are associated with templates in WebSphere
Integratin Developer.
• Implements what the architect has laid out.
• More aware of technical development and architecture.
SCA component: Business rule group
●business rules are invoked through the business rule group.
– Rules with a common focus are gathered in a business rule group.
●A business rule group is an SCA component.
●Rules within a business rule group are represented as rule sets or as
decision tables.
– The business rule group provides the interface for rule sets and decision tables.
●Run-time clients
of a business rule group include BPEL, JSPs, SCA components and the Business Rules Manager Web Tool.
Rule sets
●
There are two kinds of rules:
– If-then rules that determine the action to execute according to a condition of the incoming message.
– Action rules that execute an action regardless of what an incoming message is.
●
A rule set is a series of one or more If-Then condition and
action statements that are processed sequentially.
– Evaluated from first listed to last.
– Able to choose any number of Action/If-Then conditions.
• An Action does not have an If-Then condition, it simply initializes or sets variables.
• An If-Then condition can decide on a variable change.
●
A rule set is associated with a specific interface and operation
of a business rule group.
●
It evaluates multiple conditions and can fire multiple rules.
– Might be needed when a rule is found true and fired, then more processing needs to be done.
Decision table
●
Decision table represents a multi-conditional, nested If-Then
structure.
– The decision table represents a tree decision structure in tabular form.
– A set of If conditions withThen actions are defined at the intersection points of the table.
●
Conditions are evaluated in a nested order (tree).
●
Evaluates one condition or more, fires only one rule.
– The rule that is fired consists of one or more pre-defined actions. • For example, an action could consist of setting an output parameter to a
certain value.
– Most rules will fall under a decision tree.
• Most business rules are called to fire one rule.
●
A decision table is associated with a specific interface and
operation of a business rule group.
Decision table – Mortgage request example
● This decision table returns an approximate mortgage loan amount to
the client based on the type of property they are looking for:
– Size of the home in square feet. – Location (city or suburbs).
When to use decision tables or rule sets
●
Use decision tables when you:
– Have a rule with multiple clauses or variables in the conditional statements
– Want to fire only one rule
●
Use rule sets when you:
– Have rules with a few clauses or variables in the conditional statements