Business rules

WebSphere Business Integration Server Express includes the ability to design specific business rules, which allow the user to alter run-time behavior without requiring a complete redefinition and redeployment of the collaboration template.

Business rules are listed in both the Integration Component Library Navigator view and the InterChange Server Express Component view. Business rules allow users to define additional logic to tailor their business processes and allow the system to correlate and react to different events in the system. In a business rule, you typically select one or more business object probes to monitor and react when a certain pattern is detected related to the business object probe. In addition, there are other time-based business rules ("At," "Every") that are triggered at a predefined time and do not require the use of business object probes.

A business object probe monitors business object instance values during run time. Before developing a business rule, you must first define a business probe. For more information on using business probes to develop business rules, see the Collaboration Development Guide.

The following sections provide information necessary to add new business rules using the New Business Rule Wizard. For more information see New Business Rule wizard.

Business rule detection types below

Effective time period for business rules

About business rule event keys

Business rule actions and properties

New Business Rule wizard

Business rule detection types

Business rule detection types define when a business rule applies to the components of your system. For ease of explanation and understanding, this guide presents the detection types in the following functional categories:

Table 15. Business rule detection type categories
Detection Type Category Detection Types
Conditional Decision Table
All
Sequence
Timed At
Every
After
Collection At Least
At Most
Nth
Negation Not
Unless
Computation Analyze
Crosses
Percentage

Conditional detection types

Conditional detection types contain a set of definite conditions that must be met before activating a business rule.

The following table lists the conditional detection types, along with a definition and the associated properties:

Table 16. Conditional business rule detection types
Type Definition Properties
Decision Table Applies a set of conditions in a decision table to detect the business rule and apply business actions. Decision Table - contains conditions, names of all actions and action property value
All Applies the business rule only when all the specified events are detected and all the events satisfy the conditions of the rule. The sequence of events is not an important factor in the application of this rule. Frequency - once or always (default); Condition (optional)
Sequence Applies the business rule only when all of the events are detected in the exact order specified in the rule. Frequency - once or always (default); Condition (optional)

Timed detection types

Timed detection types contain a time frame, either an exact time, a time range, or a time interval which must be met before activating the business rule.

The following table lists the timed detection types, along with a definition and the associated properties:

Table 17. Timed business rule detection types
Type Definition Properties
At Applies the business rule at a specific time. Does not require business object probes. Time - milliseconds in the format dd/mm/yyyy hr:min:sec
Every Applies the business rule consistently at a regular interval which satisfies the conditions of the rule, for example, every minute. Time Interval - milliseconds
After Applies the business rule a specific time after an event is detected which satisfies the conditions of the rule. Wait Time Period - milliseconds; Correlate - if additional triggering events are detected within the wait time, do you want to:
Ignore those events
Add, which executes a business rule for each triggering event
Replace, which restarts the wait time using the new triggering event.

Collection detection types

Collection detection types contain a specific number of event detections that must be met before activating the business rule.

The following table lists the collection detection types, along with a definition and the associated properties:

Table 18. Collection business rule detection types
Type Definition Properties
At Least Applies the business rule when at least a specific number of events are detected and satisfy the conditions of the rule, for example, three events. Frequency - once or always (default); Quantity - greater than 1; Condition (optional)
At Most Applies the business rule when at most a specific number of events are detected and satisfy the conditions of the rule by the end of the effective time, for example, when ten events are detected within a 120 second period. Quantity - greater than 1; Condition (optional)
Note: Can only occur once within effective time period.
Nth Applies the business rule when an event is detected and satisfies the conditions of the rule a specific number of times, for example, three times. Frequency - once or always (default); Quantity - greater than 1; Condition (optional)

Negation detection types

Negation detection types activate business rules when no business event detections are present.

The following table lists the negation detection types, along with a definition and the associated properties:

Table 19. Negation business rule detection types
Type Definition Properties
Not Applies the business rule if no event is detected which satisfies the conditions of the rule by the end of the effective time. No properties
Note: Can only occur once within effective time period.
Unless Applies the business rule when a specific event is detected but no other event occurs by the end of the effective time for the rule. No properties
Note: Can only occur once within effective time period

Computation detection types

Computation detection types contain mathematical conditions which must be met before activating a business rule.

The following table lists the computation detection types, along with a definition and the associated properties:

Table 20. Computation business rule detection types
Type Definition Properties
Analyze Applies the business rule when the sum, average, minimum or maximum values match the rule condition. Frequency - once or always (default); Condition (optional)
Crosses Applies the business rule when a specific time period limit is reached, for example, when the average service time of requests exceeds ten minutes. Frequency - once or always (default); Threshold expression - calculates threshold value; Threshold value - boundary values
Percentage Applies the business rule when the calculated percentage exceeds a predefined percentage, for example, when more than 10% of credit requests are not approved. Frequency - once or always (default); Percentage - between 0 and 100; Condition (optional)

Effective time period for business rules

The effective time period for a business rule sets time constrictions on the application of a business rule. When an effective time period is set, the business rule will not activate unless the server detects the events within the specific time range.

Specify the effective time period for a business rule as either of the following:

Set the effective time period start time as:

Set the effective time period end time as:

Example of the effective time period

A collaboration template, named PurchaseOrder, contains the business logic for processing a customer purchase order. This template includes a business object probe, named startOrder, which probes the incoming purchase order when the process begins. The template also includes a business object probe, named endOrder, which probes the purchase order at the completion of processing.

In order to detect a purchase order that takes an excessive amount of time to process, you can create a business rule using the Not detection type, which is activated when the business rule is not detected within a specific time period. Set the effective time period for a specific amount of time, for example, 5 hours, after the startOrder probe is activated. In the business rule properties section, you would specify that this business rule is activated if the endOrder probe is not activated within the effective time period.

Once you have set up the business rule, you must also specify the action to take upon activation of the rule, for example, SendEmail. For more information on business rule actions, see Business rule actions and properties.

Note:
When using an event to start the effective time period, and the rule's detection pattern contains the same event, the event that activates the effective time period will not trigger the rule's detection.

About business rule event keys

A business rule event key uniquely identifies and correlates the instances of an individual business object probe, which monitors business object instance values during run time. When you specify a business rule event key, each unique key creates a partition in the business rule detection process. The system detects keys according to the partitions, and could impact memory usage at run time, since the rule engine tracks the detection states individually for each unique key value.

For more information on business object probes, see the Collaboration Development Guide.

Specifying a key allows the business rule to keep track of the rule application for each unique state identified by the key attribute value. For an example of using a business rule event key, see Example of a business rule event key.

Example of a business rule event key

In the Example of the effective time period, a business rule was developed for detecting purchase orders that take over 5 hours to process by tracking the amount of time between the activation of the startOrder and endOrder business probes.

Realistically, there will be more than one PurchaseOrder collaboration running concurrently, and most likely the processing of each order will not be sequential. This means an order that started later may activate the endOrder business probe before one that started prior.

In this sort of environment, a business rule event key can be used to keep track of events and process each event distinction separately. Using a key allows you to correlate the startOrder and endOrder probes in order to accurately activate the business rule. For example, you may choose to designate the OrderNumber attribute as the key in the startOrder and endOrder probes, allowing the purchase orders to be tracked by order number.

Copyright IBM Corp. 2004, 2005