Académique Documents
Professionnel Documents
Culture Documents
09 December 2015
The Business Rules service on IBM Bluemix minimizes your code changes by keeping
business logic separate from application logic, providing the capability for decision
management on Bluemix. This tutorial provides a brief overview of the service and details
about how to diversify existing on-premises IBM Operational Decision Management (ODM)
applications to also use the Business Rules service.
Learn how to diversify your existing IBM Operational Decision Management (ODM) applications
to also use the Business Rules service on IBM Bluemix. After an introduction to IBM ODM and the
Business Rules service and details about how they differ, you walk through deploying and running
a subset of your rules on the Business Rules service. In addition to the on-premises IBM ODM
installation, you can take advantage of the pay-as-a-service solution that is provided on Bluemix.
This content is part of the IBM Business Process Management Journal.
This tutorial is the first in the Diversify your IBM ODM application with Bluemix and the Business
Rules service series.
Trademarks
Page 1 of 14
developerWorks
ibm.com/developerWorks/
business users. The rules are stored in a repository and are deployed to the Decision Server as
RuleApps for testing and execution. The following illustration shows the IBM ODM components
and how they manage business rules.
IBM Bluemix is an open-standards cloud platform that provides mobile and web developers access
to IBM software for integration, security, transaction, and other key functions, and to software from
business partners. A platform as a service cloud offering built on the Cloud Foundry open source
technology, Bluemix is a place where you can deploy your apps, giving you immediate access to
services and expediting the delivery of a web or mobile application by removing steps for service
installation, infrastructure management, and maintenance. The following illustration shows the
Bluemix architecture.
Page 2 of 14
ibm.com/developerWorks/
developerWorks
The Business Rules service in Bluemix minimizes your code changes by keeping business logic
separate from application logic. It captures business logic in the form of business rules, which
can be run on the cloud. The following image shows the Business Rules service components and
how they manage business rules. You first develop and test the rules and the associated business
object model in the Rule Designer plug-in on Eclipse. Then, you create a Business Rules service
instance by using the Bluemix user interface. You deploy the rules in archives that are known as
RuleApps from the Rule Designer to the Business Rules service instance.
The following illustration shows the business rules service components.
Page 3 of 14
developerWorks
ibm.com/developerWorks/
Bluemix is a pay-as-a-service solution, intended to remove steps for managing and maintaining
service installation and infrastructure. The Business Rules service eases the deployment and
execution of rules by removing the need to install and maintain the IBM ODM components on
an on-premises application server instance. Also, you don't need to install and maintain an onpremises database to persist rule data.
Page 4 of 14
ibm.com/developerWorks/
developerWorks
that is linked to a ruleset path through a Java Management Extensions management bean.
However, IBM ODM also provides other options to run rules (Java Objects, Enterprise
JavaBeans, and Message-Driven beans) that are not available through the Business Rules
service on Bluemix. See Developing client applications in the IBM ODM documentation.
Interceptors are not supported by the Business Rules service.
In IBM ODM, the Rule Execution Server console provides a Testing feature to test your
ruleset with sample data. This feature is not supported by the Business Rules service on
Bluemix. However, you can test your ruleset payload from the Bluemix console, without
logging into the Rule Execution Server console. See Step 6.
In IBM ODM, you can configure rule tracing by using the ruleset properties
ruleset.trace.enabled, ruleset.sequential.trace.enabled, and filters. See Setting up
ruleset execution traces and IlrTraceFilter in the IBM ODM documentation. In contrast, rule
tracing is disabled by default in the Business Rules service. However, you can configure the
payload to enable tracing, as described in Part 2, Step 1.
In IBM ODM, you can monitor ruleset execution with the Decision Warehouse, which is a tool
for the Rule Execution Server console that stores rule execution traces in a database. The
Business Rules service does not support the use of the Decision Warehouse.
The use of Decision Validation Services (DVS) is not supported by the Business Rules service
on Bluemix. However, you can use your existing IBM ODM test environment to conduct DVS
tests on the rulesets if needed before you deploy them to the Business Rules service on
Bluemix for production.
There is no Decision Center associated with the Business Rules service on Bluemix.
Given these differences, rulesets that are prime candidates for using the Business Rules service
on Bluemix have the following characteristics:
Performance: Rulesets that are already hosted through REST transparent decision services
or SOAP hosted transparent decision services, or can be started as a web service without
negatively affecting the user or application in the transition to web services.
Rulesets that depend on the high performance that is delivered by a Java SE implementation,
for example, would not be viable candidates. To determine whether your ruleset is a good
candidate to be hosted by the Business Rules service on Bluemix, see Executing rulesets as
a web service in the Deployment architecture IBM ODM documentation, and Performance
Diversify your IBM ODM application with Bluemix and the
Business Rules service, Part 1
Page 5 of 14
developerWorks
ibm.com/developerWorks/
demands and application types in the Overview: What affects the performance of a Decision
Server application IBM ODM documentation.
Customization: Rulesets that do not require configuration at the XU level (for example, XU
connection pools or the asynchronousRulesetParsing, compiledArchivesCacheProperties XU
properties), or depend on the use of interceptors.
Maintenance: Rulesets that are usually developed, deployed, and maintained by developers,
and are not edited or deployed by business users (or infrequently).
In addition, the Business Rules service can be used for the following purposes:
You can quickly and easily validate any ruleset in development, and test the client application,
without needing to configure application servers for deployment and maintenance of the
Decision Server.
You can free up precious CPU, memory, and database resources (used by the on-premises
IBM ODM installation) to allocate to needier resource-intensive applications.
Depending on how your current IBM ODM application is structured, you might need to make
changes before your existing rules can be deployed to the Business Rules service on Bluemix and
started as web services. Continue reading to learn how to use the Business Rules service and how
to configure your existing IBM ODM application to use the service. Part 2 discusses the tracing
and performance settings applicable to the Business Rules service.
Page 6 of 14
ibm.com/developerWorks/
developerWorks
2. Configure the size of the execution pool of XML document drivers, which is set by default to
1, through the xmlDocumentDriverPool.maxSize ruleset property. This default setting might
cause a performance bottleneck if several clients run a ruleset that is exposed as a web
service concurrently. Increase the value to the number of concurrent executions of the ruleset.
For example, set it to 5, if you have five concurrent clients.
If you use a Java XOM, apply the following guidelines:
With a Java XOM, a schema is generated through the default JAXB generation and added to
the WADL or WSDL file. If you want a private attribute of a class to be part of the generated
WADL or WSDL file, ensure that the Java class has the corresponding public getter and setter
methods for that attribute. Alternatively, you can add JAXB annotations to the attribute in the
Java class:
XmlElement(name="requestAmount")
@ private double requestAmount;
Use JAXB notations to specify the namespace for the generated schema, otherwise the
default namespace will be used:
@XmlRootElement(name="my-loan", namespace="http://www.acme.com/loan")
public class MyLoan {
...
}
See the Java XOM section in the Hosted transparent decision services IBM ODM
documentation.
When you use a Java XOM with the Business Rules service, JAXB is used to instantiate
objects during rule execution. Define a default constructor for the Java classes that will be
used by the rules, since by default, JAXB uses the default constructor for instantiating objects.
This default constructor should also be made visible in the Business Object Model (BOM). If
your current application uses a non-default constructor that completes certain calculations
before it instantiates an object, modify your code so that these calculations are completed
by another method that can be started after the default constructor is called. You can start
this method on the objects in the initial actions of the ruleflow, for example. Otherwise, these
calculations will not be started when rules are started through a web service, because the
default constructor is used.
If you bundle your XOM within your application or if you use the managed Java XOM feature,
package only the JAR files that contain the classes that are directly called by the XOM.
Page 7 of 14
developerWorks
ibm.com/developerWorks/
following screen capture shows the Business Rules service in the Bluemix catalog.
3. Specify the dev space when you create the instance. You can leave the service
unbound for now, by leaving the App field blank, as shown in the following screen
capture.
4. You can now manage the Business Rules service instance Rule Execution Server
with the web-based console, which is a JMX Beans-based, graphical web interface for
managing the RuleApps (the same as in IBM ODM). Retrieve the credentials to log in to
the Rule Execution Server console from the Connection Settings tab of the Business
Rules service instance. To connect to the Rule Execution Server console, click the
Page 8 of 14
ibm.com/developerWorks/
developerWorks
Open Console link and log in using the credentials, as shown in the following screen
capture, .
Page 9 of 14
developerWorks
ibm.com/developerWorks/
If you neglected to deploy the XOM with the RuleApp, or if the XOM has been updated,
you can deploy the XOM to the Business Rules service instance from the Rule Designer.
Right-click the rule project name and then select Rule Execution Server > Deploy XOM.
Alternatively, you can deploy it using the res-deploy-xom Ant task. In the Rule Execution
Server console, configure the ruleset to use the most recent Managed XOM resource version.
3. Select your Business Rules service instance on the Bluemix console, and go
to the Decision Services tab to see your deployed RuleApps and rulesets in
the Bluemix console. Click Refresh if needed, as shown in the following screen
capture.
4. Click the ruleset name to go to the Details page, as shown in the following screen
capture. Choose the relevant tab (JSON, XML, or SOAP) for your use case. Click
WADL (or WSDL if you are using SOAP) to ensure that the description language
is correctly generated. If you see errors, revisit Step 3 to properly configure the
XOM.
Page 10 of 14
ibm.com/developerWorks/
developerWorks
However, you can test your ruleset payload from the Bluemix console, without logging in to the
Rule Execution Server console.
Each ruleset can be started as a SOAP/XML, REST/XML, or REST/JSON web service. The
REST service passes incoming data as HTTP content in XML or JSON format. The REST/JSON
invocation protocol supports an execution object model (XOM) based on Java. The Business
Rules service provides a REST service that handles the payload generation through the HTTPS
protocol.
1. From the Ruleset Details page (the previous screen capture), click Back to Decision
Services.
2. To test the ruleset, click the arrow icon next to it. The Test page shows the Decision Request
and the Decision Response, as shown in the following screen capture. Choose the relevant
data format (JSON or XML) and generate the corresponding sample payload under Decision
Request.
3. Populate the generated payload with test data, and click Run Test. The ruleset is run with
test data, with the response from the ruleset execution that is displayed under Decision
Response. See Testing a ruleset in IBM Bluemix documentation.
Page 11 of 14
developerWorks
ibm.com/developerWorks/
Configure your client application to start rulesets that are hosted on the Business Rules service, by
using the following guidelines:
If your current application relies on the use of rule sessions, JMS messages or SCA services
to start rules, modify it to start your ruleset as a SOAP/XML, REST/XML, or REST/JSON web
service, through a web request. The Samples and Tutorials documentation for the Business
Rules service shows how to use both technologies to start rules.
If you choose to host your client application on Bluemix, bind the service instance to the
client application. In the Bluemix console dashboard, select your app, click Bind a service
to choose the service instance that is created in Step 4. If your client application is external
to Bluemix, use the credentials from the Connection Settings tab (in Step 4) to connect to the
service.
If you use the REST service, generate a JSON or XML payload based on the ruleset
parameters by entering a GET request to specified URIs:
GET ruleset_URL/json
GET ruleset_URL/xml
The ruleset_URL is the URL that you retrieve from the Ruleset Details page in Step 5. You
also can generate an XML or JSON payload from the Decision Services page, as described in
Step 6.
Next, configure your client application to make the execution request by using the POST
method:
POST ruleset_URL
The request body must contain the ruleset input parameters as an XML or JSON payload
(which you generated earlier with the GET requests). Because the REST service uses basic
HTTP authentication, use the provided credentials for the service instance.
If you are using SOAP in your environment, use the URL specified in the SOAP tab of the
Ruleset Details page (in Step 5) to call the ruleset. Specify the input parameters in the XML
format.
The execution response is in the same format as the execution request. Configure your client
application to process the response data.
Configure your application to not depend on the use of interceptors, since they are not
supported by the Business Rules service. Take this approach even if your current IBM ODM
application uses interceptors with transparent decision services.
Conclusion
In this tutorial, you learned how to diversify your existing IBM ODM application to use the Business
Rules service on Bluemix. To learn the tracing and performance configurations for the Business
Rules service, see Part 2.
Acknowledgements
The author would like to thank Alain Robert and Pierre Berlandier for their reviews of this tutorial.
Additional appreciation goes to the IBM ODM and Business Rules service technical resolution
teams, including Level 2 and Level 3 Support teams, and research and development.
Diversify your IBM ODM application with Bluemix and the
Business Rules service, Part 1
Page 12 of 14
ibm.com/developerWorks/
developerWorks
Page 13 of 14
developerWorks
ibm.com/developerWorks/
Page 14 of 14