Using Business Rules in your Bluemix Applications without hardcoding them

IBM Bluemix provides a service to define business rules external to your application code. This allows changing rules more dynamically without having to recompile and redeploy the complete application.

There is plenty of documentation available that I won’t repeat here: Business Rules documentation, developerWorks articles and samples and tutorials. Below is just a quick summary for what this service can be used and how to leverage it in Bluemix.

The example I’m using is from an article Build a hotel booking application which provides a detailed description how the service works. In this scenario a business rule is defined to determine the pricing of a hotel based on the date of the booking offering early booking discounts or last-minute offers. With the business rules service this can be done without low level programming skills using a Rule Designer plugin in Eclipse.

After the service has been created in Bluemix, you can get your connections settings.

In Eclipse you need to use these settings when deploying the rule to Bluemix from your IDE.

After the rule has been deployed to Bluemix, you can execute it via REST APIs. There is a Java sample that shows how to do this. You can also invoke the rule and receive the results in a Node-RED flow. Check out the sample flow. The dashboard of the service also provides an easy way to test the service.