Monday, September 12, 2011

Business Rules and Business Process Exceptions

Often a business process team will create a working prototype of a business process. These prototypes might arise from 'use-cases' or business cases.

This idealized process develops a deep understanding of the final version, yet much of the important work remains. You should even consider executing this development artifact in a test bed. Yet to complete a business process, the technical team should detail the process diagram with the necessary scheduling, exceptions and compensations. The purpose of the details is to erect a more complete process model. The business processes should act on all the messages, including the system failures. The process should handle every anticipated exception.

There are 3 types of exceptions may affect process execution:

  • Technical exceptions
  • Transient exceptions
  • Business exceptions

As we will see, business rules can create, named business exceptions. If a BizTalk Orchestration is transactional, the process should compensate for transactions that fail to complete. In compensation, the process cleans up or backs out records from ERP’s, operational datastores or data warehouses.

Often processes should be complete within a time period, so there could be time out actions noted on the diagram. Business processes usually receive a message and translate that message into yet another message for consumption by the next part of the process. BPMN is powerful for developing time-outs, exceptions and compensations. As seen in the BPMN fragment below, you can attach time-outs, exceptions and compensations directly to a subprocess task list. When time-outs and exceptions occur within the two process tasks, the BizTalk Orchestration traps these at the point of the subprocess.

 

image

Figure 1 BPMN fragment

In this scenario, a grant authorization system evaluates grants and records the data. The time-out BPMN (the clock) will raise a time-out exception and wait. The diagram reports any exception that occurs (the zigzag) to the exception task. The compensation takes care of a record in the grant database.

You can model Business Processes with advanced abilities that suspend processing, or communicate with disconnected, mobile processes. These powers yield opportunities for the enterprise to fine-tune their most complicated practices. Yet to develop these capabilities you should understand how to handle the three types of exceptions and what you must plan for when developing the production version of the process diagram.

A business process diagram should use exception handlers to redirect the process flow in case a transient or business exception happens. However, no process can manage every exception. There are technical exceptions that will cause the entire process instance to suspend.

 

Technical Exceptions

Technical exceptions occur when the process causes the process instance to fail. An internal server exception should be abnormal; however there are operational circumstances that cause these. Technical exceptions include:

The common .Net Null exceptions

  • Exceptions caused by Illegal Argument exceptions, (suppose an external operational system decides to change a field from 10 to 20 characters)
  • Server database exceptions, out of tablespace, violation of database constraints

These are outside and therefore invisible to the calling subprocess. Processes cannot handle them because the execution state of the process has stopped. When this technical exception happens, the current transaction is always marked for rollback. The process throws the exception to the scheduler or message router.

 

Transient exceptions

A transient exception is usually caused by code external to the server like database connections or connection pooling exceptions. Within the scope of the current transaction, a transient exception is visible and the process can catch it with an exception handler. If the exception is not handled in the scope of the current transaction, the subprocess marks the transaction for rollback and throws the exception to the scheduler or message router. The process is suspended.

The suspended process can be restarted and resume processing after the database connection or some other condition is restored.

 

Business Exception

A business exception is one that can be expected by the process. Examples of these exceptions include:

  • ·Exception raised by an activity, a specific, named exception is raised, for instance a business rule could raise a named exception.
  • Exception caused by receiving an error message (like an SOAP fault).

If the exception is not handled in the scope of the current activity, the activity fails. When the activity defined a coordinated transaction, the transaction is committed. When no exception handling takes place Exception processing begins and leads to compensation and the failure of the process.

 

Business Rules Decisions and Business Exceptions

Many organizations use the BizTalk 2010 Business Rules Engine (BRE) to validate and transform incoming transactions. Validations and transformation are important types of 'decisions' that a business process makes with the data within process flows.

This is a common decision pattern: evaluate a set or transactions, say from an incoming data set. Each record that fails the validation should be stored in an area for latter cleanup. You can either handle the validation directly, with values in the process flows or you can raise a business exception, create a reusable process for handling the exception and move on.

Another common decision pattern validates user form input, in a workflow. Users might correctly complete a form and send it to a process flow. If there are business rules that violate complex data and business conditions, the process should collect data from the user at a later date.

Figure 2 is an example of what I am describing. A decision service validates incoming data. If the data does not pass validation, the subprocess raises a named exception, otherwise the record is processed.

image

Figure 2 Decision Services

The basic idea is to design your exceptions, time-outs and compensations to enlarge the flexibility of the process and allow most process to continue unattended. Handle the process and move on.

 

Diagram complexity

The complete BPMN diagram has many important exception features that must be accommodated.

Unfortunately, these additional boxes and notations make it difficult for business users to understand. This is where you use a BPMN Structuring Phase diagram. This diagram does not display exceptions, compensations and timers attached to subprocesses. The tasks following these should also not be displayed. This would clarify the core nature of the process and provide your business users an easy to understand document.

 

Windows Live Tags: Rules,Exceptions,Often,team,prototype,prototypes,version,development,artifact,diagram,compensations,purpose,messages,system,failures,exception,execution,Technical,Transient,BizTalk,Orchestration,transactions,compensation,data,warehouses,message,consumption,BPMN,task,tasks,Figure,scenario,authorization,clock,database,Processes,abilities,opportunities,enterprise,capabilities,production,handlers,instance,server,Null,Illegal,Argument,violation,constraints,transaction,connection,Within,scope,handler,Examples,error,SOAP,failure,Decisions,Many,Engine,Validations,transformation,decision,validation,area,cleanup,Another,user,Users,example,Services,Handle,notations,Phase,timers,Tags,outs,rollback,scheduler,router

No comments:

Post a Comment