Business rules

A business rule is a required operation that applies to a specific set of business conditions. For example, you can create a business rule that offers a discount to customers who spend more than a certain amount. The business rule can be modified in the future if the business climate changes and the amount of discount must change.

You can use IBM® Integration Bus to write business rules by using natural language instead of coding in ESQL or Java™. The use of natural language in the authoring of the rules means that they can be understood by business users (for example, a business analyst). In IBM Integration Bus, you create a decision service, which is a collection of rules.

You can also import business rules that are written in IBM Operational Decision Manager and use them to process messages in IBM Integration Bus.

You can use business rules to update the business logic that is applied to message processing as business conditions change. Here are some examples of the capability that business rules can provide.
Routing
Business rules provide smart, dynamic routing in the message flow that is based on the business content of the message. For example, business rules can control least cost routing: If a customer places an order, business rules can be used to determine which facility is the most appropriate to fulfill that order. This decision can be based on the types of item that are ordered, the location of the customer, and the required speed of delivery.
Validation
Business rules provide message validation that is based on the business content of the message; for example, business rules can provide content validation. If an account number starts with ABC, the next four characters must be numbers. But if the account number begins with XYZ, the account number must contain five numbers.
Transformation
Business rules can be applied to message content to modify the values in that message. For example, you can change the discount that is offered to a customer when certain conditions are met, such as a purchase above a certain amount.

Consider an example of a business rule where customers who spend a lot of money in a single transaction are provided an upgrade.

To create business rules, first specify the vocabulary that is required to express the policy, then represent the logic of the business policy as "if-then" statements. In IBM Integration Bus, you use a Decision Service editor to specify the parameters that form the vocabulary for writing rules. A typical parameter is shown in the following example.
Name Type Verbalization
myCustomer CustomerType The customer
If you already have a decision service file, you can drag it on to a DecisionService node or use the node properties to locate it. Alternatively, you can double-click the node or use menu options to create a decision service by using a wizard. When you import a rule application archive from IBM Operational Decision Manager, it is converted to a decision service, which you can associate with a DecisionService node. You cannot use the IBM Integration Toolkit to view or edit the rules that you import from IBM Operational Decision Manager.
Business rules act on business object, such as a customer. This business object is represented by an XML schema. IBM Integration Bus supports rules that are created from XMLNSC or DFDL schemas. For decision services that you create in IBM Integration Bus, you write the business rules in the Decision Service editor by using the vocabulary that you define. The following example shows how natural language parameters are used in the Decision Service editor to implement the business policy:
if
 the category of the customer is Gold
 and the value of the shopping cart of the customer is more than $1500
then
 set the category of the customer to Platinum 
Rules are written by using the Business Action Language (BAL). For more information, see Structure of a business rule.

You can find more information about XML binding, XML declarations, and schema mapping limitations in IBM Operational Decision Manager product documentation online.

For an example of how the incoming message and XML schema relate to the parameters that are passed into business rules, see Example rules that are created from a message instance and schema.

These parameters and rules are contained in a decision service (.rules) file that can be deployed. When you deploy a BAR file that contains a decision service that you created in the IBM Integration Toolkit, the decision service is compiled into a rule set (.ruleset). Imported rules contain compiled rule sets. In the form of a decision service, the business logic can be called from the message flow as a business rule application. Therefore, changes to the business policy do not require changes to the message flow.

You can write rules in the IBM Integration Toolkit and at run time retrieve them from the local application, library, or integration project. You can also import business rules that were written in IBM Operational Decision Manager and retrieve them from an IBM Operational Decision Manager repository at run time. A configurable service is provided for you to specify connection details.