DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Enterprise AI Trend Report: Gain insights on ethical AI, MLOps, generative AI, large language models, and much more.

2024 Cloud survey: Share your insights on microservices, containers, K8s, CI/CD, and DevOps (+ enter a $750 raffle!) for our Trend Reports.

PostgreSQL: Learn about the open-source RDBMS' advanced capabilities, core components, common commands and functions, and general DBA tasks.

AI Automation Essentials. Check out the latest Refcard on all things AI automation, including model training, data security, and more.

Related

  • Building a Real-Time Alerting Solution With Zero Code
  • Building Modern 3factor Apps in 2021 With Event-Driven Programming
  • Virtual Network Functions in VPC and Integration With Event Notifications in IBM Cloud
  • WebSocket vs. Server-Sent Events: Choosing the Best Real-Time Communication Protocol

Trending

  • WebSocket vs. Server-Sent Events: Choosing the Best Real-Time Communication Protocol
  • Understanding Escape Analysis in Go
  • Real-Time Communication Protocols: A Developer's Guide With JavaScript
  • 6 Agile Games to Enhance Team Building and Creativity

How to Model Business Rules

Learn how to model business rules using BPMN 2.0, an open-source software that makes modeling easy to understand for technicians and management.

By 
Ralph Soika user avatar
Ralph Soika
·
May. 24, 18 · Presentation
Like (7)
Save
Tweet
Share
9.6K Views

Join the DZone community and get the full member experience.

Join For Free

Today, when you design a modern business application, you have to deal more and more with constantly changing business rules. The reason for this is that not only the software industry follows the agile path. Business processes are also subject to a permanent change. At the same time, however, business processes are becoming increasingly complex as more and more information is influencing our business world. In the following article, I will show how business processes and their rules can be modeled with the help of BPMN.

BPMN 2.0 and Event-Based Workflows

The "Business Process Model and Notation", or  BPMN 2.0, is the common standard to describe a business process. BPMN was initially designed to describe a business process without all the technical details of a software system. As a result, BPMN diagrams are easy to understand and a good starting point to talk about a business process with a technician as well as with management. The Eclipse BPMN2 Modeler provides a graphical modeling tool for authoring business processes based on BPMN 2.0. One advantage of BPMN models is that they can also be executed by a workflow engine. With this approach, it is possible to model complex business logic which previously has been hardcoded.

BPMN engines basically support two modeling approaches – a task-oriented and an event-oriented one. A task-oriented workflow engine typically executes each task immediately, sequentially or in parallel, and returns the result. JBPM or Activiti are examples of implementations of this kind of engine. In contrast to this approach, an event-oriented workflow engine manages the state of a business process and waits for events to be executed. This second approach is typically for human-centric workflow engines like Imixs-Workflow. In the following, I will show some examples how to model a business process with complex business rules based on the event-oriented approach.

Take a look at the first example:

Image title

This is a typical human-centric business process. After a new ticket workflow was started, the actor (e.g. a support-agent) decides if the ticket can be accepted or is invalid. The workflow engine waits in the status "New Ticket" until one of the events is fired. The exclusive gateway after the initial task is a so-called "Event-Gateway" with two exclusive events.

Events can also be concatenated to cause a sequential execution of different events. For example, to send an e-mail after a new task was submitted:

 Image title

This is called a follow-up event. The workflow engine will automatically fire the event “Send E-Mail” after a new ticket was submitted. We will shortly see how these events can be used to execute different business rules.

Conditional Events

Now let's talk about more complex situations and how to model them. As I have already indicated in the beginning, business processes are often influenced by what information is available. Let us assume that an event triggers different tasks depending on the information which is available in the business task. In this situations conditional events can be used:

Image title

In this example, an exclusive gateway is placed after the "Submit" event. The gateway has two conditional sequence flows (SL=1 and SL=2). Conditions can be declared within the model:

Image title

So the business logic is now part of our model and can be easily changed and adapted if the business rules will change.

Split Events

Another situation is the need to split a task so it can be processed in parallel by different actors. In BPMN we use an inclusive gateway to start processing in parallel. The workflow engine creates a copy of the running process instance. Both instances are still running in the same model but can be processed by different actors or manage business data in different ways. A situation where this modeling approach is often used is to duplicate or archive business data. See the following example:

Image title

In this example, when a new “Offer” was rejected, the current version of the process instance will be archived and a new version will be continued in a change process.

Of course, this variant can also be combined with other variants. Take a look at the following example which combines a conditional event with a split event:

 Image title

In this example, the ticket with ServiceLevel=1 will be split into a "Medium Ticket" and a “Reporting” task. Both instances are running still in the same model but can be processed in different ways.

Working with Different Business Models

The business logic we have modeled so far was restricted to one workflow model. But it is, of course, also possible to start new process instances in another workflow model. This is called a sub-process which is triggered by the main process but runs in an independent workflow model. See the next example:

Image title

In this example, a "Sales" process provides the management of customer data. In case a new customer data was submitted, the model tests if an offer is available. If yes, a new sub-process “Order” is triggered. This process runs in a completely independent workflow model. But the workflow engine is aware of the "parent-child" relationship which allows the subprocess to interact with the parent process. For example, the submit event of the "Order" process can send business data back to the "Sales" process.

The creation of a sub-process is bound to the event "submit order":

Image title

This is a powerful function to control and link different processes.

Conclusion

After this brief insight into the possibilities of modeling business logic with the help of BPMN 2.0, it becomes clear what advantages result from this. First of all, the business logic becomes more transparent because now business rules become visible and understandable. Secondly, business rules can be changed without having to change the source code of the application. This is an important factor to be able to react quickly to changes in an agile environment. In addition to these obvious advantages, BPMN also makes it possible to design very complex business rules and process flows which can be executed by a workflow engine. It may take some time to familiarize yourself with those concepts, but the benefits of creating a modern and flexible business application are worth the effort. The open source project "Imixs-Workflow," which provides a free event-orientated workflow engine, provides additional information and more examples.

Workflow engine Event Business logic Business process

Published at DZone with permission of Ralph Soika. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Building a Real-Time Alerting Solution With Zero Code
  • Building Modern 3factor Apps in 2021 With Event-Driven Programming
  • Virtual Network Functions in VPC and Integration With Event Notifications in IBM Cloud
  • WebSocket vs. Server-Sent Events: Choosing the Best Real-Time Communication Protocol

Partner Resources


Comments

ABOUT US

  • About DZone
  • Send feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: