Pages

Sunday, September 10, 2017

Role of Business Rules in Enterprise Integration space

Every organization depends on decision making to reach its objectives. We can categorise those decisions into different types: Strategic decisions, Operational decisions, repetitive/routine decisions, etc.


For small scale businesses, decisions may make on the fly. But when an organization grows up, an increase of customer base, decisions made on the fly will cause inconsistent decisions and slow decision-making process, which may lead quality issues of provided services and even losing customers. Therefore well defined, documented set of rules/policies are required.

What is business rules?

According to Wikipedia:
“Business rules tell an organization what it can do in detail, while strategy tells it how to focus the business at a macro level to optimize results. Put differently, a strategy provides high-level direction about what an organization should do. Business rules provide detailed guidance about how a strategy can be translated to action.” [https://en.wikipedia.org/wiki/Business_rule]


According to Ronald G. Ross:
"… a discrete operational business policy or practice. A business rule may be considered a user requirement that is expressed in non-procedural and non-technical form (usually textual statements) …A business rule represents a statement about business behavior …"
[The Business Rule Book (First Edition), by Ronald G. Ross, 1994]


We can define business rules in many different ways. Literally, they are used to run the business. Business rules can be considered as a guide to execute day-to-day operations of an organization.


Rules can be used in different ways, for example,
  • Access control: Clearly defining what are the requirements need to meet to grant clearance for a particular resource of an organization.
  • Business calculations: Salary increment calculation
  • Rules focusing on policies: Government approval for new building
Likewise you are may be using business rules even without knowing that using it.


When creating business rules, there are basic principles to follow (some rules to create better rules). If I extract the entire list, listed in “Principles of the Business Rule Approach” by Ronald Ross:
  1. Rules should be written and made explicit.
  2. Rules should be expressed in plain language.
  3. Rules should exist independent of procedures and workflows.
  4. Rules should build on facts, and facts should build on concepts as represented by terms.
  5. Rules should guide or influence behavior in desired ways.
  6. Rules should be motivated by identifiable and important business factors.
  7. Rules should be accessible to authorized parties (e.g. collective ownership).
  8. Rules should be single sourced.
  9. Rules should be specified directly by those people who have relevant knowledge (e.g. active stakeholder participation).
  10. Rules should be managed.


At this point sometimes, you might be confused and mix business rules with business processes/workflows. To be clear, business rules are not business processes, they are two separate entities, which can be used together (since they are closely related, more often used together in the real world). Business rules can be a part of a business process.  Actually, business processes depend on business rules for decision making.


Model

When using defined rules we have to collect Facts (AKA Knowledge, Information, Data) that expected/required by the rule. A well-defined rule will include what information is needed to process it. The person (in case if automated the software/rule engine) process that Facts against the rule set and produce the result as defined in the rule.


If we try to model above:


Model.png
In real world, the processing is done by a person or a software. That software is known as “Rule Engine”.

Business Rules in real world

Let’s start with real world example: Loan approval process of a bank


Example.png


First, the client comes to account manager and discusses possibilities and available loan schemes etc. The client provides applications and required documents to process. Account manager verifies provided documents and transfers them to loan department. Then someone from that department will process. In exceptional cases, he/she takes consult his/her manager and approve or reject the loan application.


Now let's identify business rules in above process:


Example_highlightRules.png


As shown in the above image, each person does take the decision by referring documents provided to them by the bank administration or some decision-making body. We can consider those documents as business rules. The information provided by the applicant verbally/Documented, and information produced by each person in the process are Facts/Knowledge that is applied against documented rules.

Business Rules in Digital world

With organizations adhere digital transformation, printed documents are no longer useful for business rules. Actually, people referring those documents and manually processing facts against those business rules are highly inefficient and ungovernable with organization growth. For example, if the bank in above example decides to change some policies, they have to format documents, print them, deliver and employees have to read it.


By digitizing those rules to executable scripts and using rule engines to evaluate Facts against those rule, allow upper management to make their strategic decisions into actions, in split seconds.


To adhere with digital transformation, most organizations use enterprise integration platform (AKA Enterprise Service Bus) to adopt new technology with their existing legacy systems. That allows them to use Rule Engines to process Facts over rules without changing their existing IT system. Also, they model their business processes and use workflow execution engines to execute them. With the help of the integration layer, those systems can interconnect each other. Some enterprise integration platforms provide all of those functionalities OOTB, for example, WSO2 Enterprise Integrator (Consist of an ESB profile, a Business process profile for workflow execution and Business rule execution facilities using rule engine).


Development of Business Rules scripts

Development of business rules in the corporate world is a never ending cycle.
Rule Cycle.png

Step 0
First of all, initial discussion to introduce new policy/rule to a particular business process or to digitize existing policy or rule.


Step 1
Based on the discussion, document the policies with details. If it is a modification to an existing policy, update the relevant document reflecting changes.


Step 2
Transform the policy/rule document to rule script for the rule engine in the integration platform. Or update existing rule to reflect new changes


Step 3
Deploy the rule script in the QA environment and test for bugs and loopholes.


Step 4
After satisfied with test results deploy the rule in production integration platform. If it is a new rule to the system update relevant business process/ mediation flows to use the newly deployed rule.


Step 5
Monitor and collect data of the business process or mediation flow and analyze to detect bottlenecks.


Step 6
Discuss and make decisions to improve current processes or mediation flows based on the analytics. And update policy/rule documents and start the cycle again.

Business Rules within enterprise integration environment



Business rules are mainly used for decision making in Business processes (Workflows) and message mediation flows in enterprise integration. When the decision-making conditions are too complex to model in a workflow or mediation flow,  integration experts tend to use rules to perform decision making.


Benefits of using Business Rules



  1. Easy to model complex decision-making conditions.
  2. Logic and data separation.
  3. Easier to Understand:
By creating object model or with the support of Domain Specific Languages, rules looks close to natural languages. So easier to understand for a business analyst or a new developer or even nontechnical person that can lead to domain experts of the business, to create the rules by themselves.
  1. Improved maintainability:
When policy changes of the organization, do not need to change existing system in code level. Just need to deploy the updated version of the rules script.
  1. Reusability:
Rules are normally kept in repository separated from business logic which allows reusing.

As the finale, if we design the above-mentioned loan approval example within integration platform, it will be as follows:


Conclusion

Every organization depends on decision making. Some of them are repetitive and able to automate to provide better service to the customers by increasing productivity. Also, as a by product some reduction of operational cost and other benefits by using business rules. To achieve this availability of business rule engine in the integration platform is a huge advantage.

Reference


  1. The Business Rule Book (First Edition), by Ronald G. Ross, 1994
  2. Principles of the Business Rule Approach by Ronald Ross, 2003

Friday, August 4, 2017

Powerful capabilities of WSO2 ESB

WSO2 enterprise service bus


WSO2 Enterprise Service Bus is the leading ESB solutions in the market which is 100% free and open source with commercial support. It is a battle tested Enterprise Service Bus catering for all enterprise integration needs. With its new release, we have taken the capabilities of WSO2 Enterprise Service Bus (WSO2 ESB) to a new level.

The WSO2 ESB is now more powerful than ever before, catering 360 degrees of seamless Enterprise Integration requirements with capabilities of integrating legacy systems to cutting edge systems.

WSO2 ESB is like as "swiss army knife" for system integration. With the new release of WSO2 ESB, it's more powerful than ever.

In this post I would like to list some powerful capabilities of WSO2 ESB:

  1. WSO2 ESB now comes with 
    • Built in Data services server ( DSS ) exposing your data stores as Services and APIs.
    • Business Process Server (BPS) to cater for business-processes / workflows (BPEL, BPMN) and human interactions (WS-Humantask) with Business Process Profile 
    • Message Broker (MB)  catering fully pledged messaging capabilities including JMS 1.1 and JMS 2.0 for enterprise messaging with Message Broker profile
    • Integration Analytics message tracing and analytics support with analytics profile
  2. One of the best performing open sources ESB's in the market.
  3. A mature product and supports all enterprise integration patterns.
  4. Complete feature set to cater for any integration need.
  5. Eclipse based IDE support to quickly develop, debug, package, deploy your integration flows.
  6. Consultancy / Support and Services are readily available from WSO2 and WSO2 Partners world wide.


For more interesting information on WSO2 ESB, read through this comprehensive article written by Samisa Abeysinghe (Chief Engineering and Delivery Officer - WSO2 ) on What is WSO2 ESB.

http://wso2.com/library/articles/2017/07/what-is-wso2-esb/

This article explains about when you should consider using WSO2 ESB, what are the advantages of it and also about the powerful capabilities of WSO2 ESB.

Download and play with it now ... ENJOY !!

Thanks,
Mili

Saturday, July 22, 2017

Setting up SMB file share in fresh Windows Server 2012-R2


Open "Server Manager" and Navigate to File and Storage Services > Volumes



In Volumes view, you can find SHARES section, click on "Start the Add Roles and Features Wizard" for feature installation wizard.

Under Server Roles tab, select "File and iSCSI Services" as shown below and click Next.




Click Next to reach Confirmation tab, which will list down installed server roles as follows. Click Install to install them.


Click Close to complete the installation.



Now, create SMB share. Navigate to File and Storage Services > Volumes
Then click New Share to start New Share Wizard under TASKS in SHARES section.




Select the "SMB Share - Quick" as file share profile and click Next




Browse to the directory shared or Select relevant volume in Share Location tab. Then click Next



Provide Share Name and click Next



Keep default settings in Other settings tab, if not needed, and click Next to navigate to Permissions tab.
Click Customize Permissions 


In Advanced Security settings view, under Share tab, you can find permission entries. By default, it contains Read-only rights for everyone. 
Here, I'm adding permission entry to provide full-control (RW) to Administrator user. To perform that click Add to add new permission entry.



 Click Select a principal in Permission Entry view


Provide User name or group name under "Enter the object name to select" text box. Here I'm providing Administrator (user name) and click OK


Then select relevant permission level under Permissions section and click OK


Newly added permission entry will list down as follows.


Click OK and click Next to Confirm changes and complete New Share wizard


After closing the wizard, newly created SMB file share will be listed under Share tab as follows



Now you can access SMB share from a remote machine within the network with URI smb://[Host/IP]/[Share_Name]. eg: smb://192.168.58.5/SMB_SHARE 

ENJOY FILE SHARING !!

Thanks,
Mili





Tuesday, June 6, 2017

How to solve Optimistic locking error if you get with WSO2 BPS with Oracle combination

There is possibility to get transaction warning optimistic locking error as shown below

[BPELServer-3] [2016-03-29 06:45:41,125]  WARN {Transaction} -  Unexpected exception from beforeCompletion; transaction will roll back
org.apache.openjpa.persistence.OptimisticLockException: Optimistic locking errors were detected when flushing to the data store.  The following objects may have been concurrently modified in another transaction: [org.apache.ode.dao.jpa.MessageDAOImpl@21dae500, org.apache.ode.dao.jpa.MessageDAOImpl@45fcaea2, org.apache.ode.dao.jpa.MessageDAOImpl@497908f1, org.apache.ode.dao.jpa.MessageDAOImpl@47bbc1bc, org.apache.ode.dao.jpa.MessageDAOImpl@6334d00f, org.apache.ode.dao.jpa.MessageDAOImpl@39c2059, org.apache.ode.dao.jpa.MessageDAOImpl@773f167b, org.apache.ode.dao.jpa.MessageDAOImpl@6eeda72e]
at org.apache.openjpa.kernel.BrokerImpl.newFlushException(BrokerImpl.java:2326)
at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2174)
at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:2072)
at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1843)
at org.apache.openjpa.kernel.DelegatingBroker.flush(DelegatingBroker.java:1045)
at org.apache.openjpa.persistence.EntityManagerImpl.flush(EntityManagerImpl.java:663)
at org.apache.ode.dao.jpa.ProcessInstanceDAOImpl.delete(ProcessInstanceDAOImpl.java:227)
at org.apache.ode.bpel.engine.BpelRuntimeContextImpl$2.beforeCompletion(BpelRuntimeContextImpl.java:254)
at org.apache.ode.scheduler.simple.SimpleScheduler$2.beforeCompletion(SimpleScheduler.java:340)
at org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:514)
at org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:498)
at org.apache.geronimo.transaction.manager.TransactionImpl.beforePrepare(TransactionImpl.java:400)
at org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:257)
at org.apache.geronimo.transaction.manager.TransactionManagerImpl.commit(TransactionManagerImpl.java:238)
at org.apache.ode.scheduler.simple.SimpleScheduler.execTransaction(SimpleScheduler.java:298)
at org.apache.ode.scheduler.simple.SimpleScheduler.execTransaction(SimpleScheduler.java:246)
at org.apache.ode.scheduler.simple.SimpleScheduler$RunJob.call(SimpleScheduler.java:541)
at org.apache.ode.scheduler.simple.SimpleScheduler$RunJob.call(SimpleScheduler.java:525)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.openjpa.persistence.OptimisticLockException: An optimistic lock violation was detected when flushing object instance "org.apache.ode.dao.jpa.MessageDAOImpl@21dae500" to the data store.  This indicates that the object was concurrently modified in another transaction.
FailedObject: org.apache.ode.dao.jpa.MessageDAOImpl@21dae500
at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.checkUpdateCount(BatchingPreparedStatementManagerImpl.java:303)
at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushBatch(BatchingPreparedStatementManagerImpl.java:186)
at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.batchOrExecuteRow(BatchingPreparedStatementManagerImpl.java:104)
at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushAndUpdate(BatchingPreparedStatementManagerImpl.java:83)
at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushInternal(PreparedStatementManagerImpl.java:99)
at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flush(PreparedStatementManagerImpl.java:87)
at org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:550)
at org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:106)
at org.apache.openjpa.jdbc.kernel.BatchingConstraintUpdateManager.flush(BatchingConstraintUpdateManager.java:59)
at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:103)
at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:76)
at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(JDBCStoreManager.java:713)
at org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:131)
... 21 more
....................

[BPELServer-3] [2016-03-29 06:45:41,148] DEBUG {org.apache.ode.bpel.engine.InstanceLockManager} -  Thread[BPELServer-3,5,main]: unlock(iid=253)
[BPELServer-3] [2016-03-29 06:45:41,149] DEBUG {org.apache.ode.bpel.engine.MyRoleMessageExchangeImpl} -  Received myrole mex response callback
[BPELServer-3] [2016-03-29 06:45:41,149]  WARN {org.apache.ode.bpel.engine.MyRoleMessageExchangeImpl} -  Transaction is rolled back on sending back the response.


This occurs with OpenJPA + Oracle combination (This occurred to me with Oracle 11g). According to [1] OpenJPA performs some statements as batches which may fail in several cases.

[1] https://wso2.org/jira/browse/CARBON-7500