Welcome!

Weblogic Authors: Yeshim Deniz, Elizabeth White, Michael Meiner, Michael Bushong, Avi Rosenthal

Related Topics: Weblogic

Weblogic: Article

State Machines and Workflow

The process-oriented application

The state machine is one of the most successful ideas in the history of computing. Alan Turing built a model of computability around the concept, and in doing so became the father of computer science. Mealy, Moore, Harel, and other theorists expanded the idea, influencing engineers of digital logic, real-time, and embedded systems whose designs are peppered with state machines and diagrams.

The concept of the state machine is also a natural fit for many contemporary enterprise applications, particularly those that are process-oriented. The distinguishing characteristic of a process-oriented application is its movement over time from state to state, or put differently, its progression from milestone to milestone to an ultimate goal. An application that manages the processing of an insurance claim is a typical example: the claim, over its lifetime, is passed from one person to another in a succession of approvals, and is defined at all times by how far it has gotten. But not all enterprise applications qualify. For example, in an automated teller machine (ATM), which lets users query their account balance, withdraw cash, deposit checks and cash, and pay bills, any sense of process is extremely short-lived and inessential; an ATM is an online transaction processor, not a process-oriented application.

The process that defines the insurance application is described by the state diagram shown in Figure 1.

 

The claim is initially idle. It enters the proposed state when it is first received into the claims department. In that state, it is examined by an analyst and can be accepted, refused, or passed on for further analysis, at which point it enters the waiting state. In the waiting state, the claim is further analyzed and is ultimately accepted or refused. A time limit for analysis is set; if the claim waits too long it is escalated to a supervisor, who examines the claim and accepts or refuses it. An accepted claim is examined by another analyst, who must activate it, at which point the claim enters the active state. At any point (in other words, in any state) a claim can be killed, which takes it back to idle.

Workflow and State Machines
The popularity of workflow application frameworks, such as the Business Process Modeler (BPM) component of BEA WebLogic Integration, proves not only that process-oriented applications abound, but also that companies are willing and eager to use high-level modeling languages to develop these applications. Besides state machines, workflow technology is an obvious implementation choice for business processes because a workflow is often the most similar representation of the process. That is, a workflow in BPM's design tool looks like what the business analyst has in mind or has drawn on paper. The insurance example looks like Figure 2 in WebLogic Integration 8.1 and Figure 3 in version 7.0.

 

 

The steps are the following:

  1. The workflow is started when a claim is received.
  2. The workflow is always waiting for a kill event. If that event occurs, stop claim processing no matter what step the workflow is at.
  3. A claim is initially assigned for evaluation to a person or role.
  4. If the initial evaluator refuses the claim, the workflow stops.
  5. If the initial evaluator deems further analysis needs to be done, the claim is assigned to another person or role for analysis.
  6. If the initial evaluator accepts the claim, the claim is assigned to a person or role for activation.
  7. If the person analyzing the claim refuses it, the workflow stops.
  8. If the person analyzing the claim accepts it, the claim is assigned to a person or role for activation.
  9. If time expires on the person analyzing the claim, the claim is assigned to a person or role for escalation.
  10. If the escalator refuses the claim, the workflow stops.
  11. When the person activating the claim does so, the workflow stops.
Workflow is procedural: it describes how a process should run. By contrast, the state machine representation of a process is declarative; to define a process is to declare its states and transitions. There are advantages and disadvantages to each approach. For example, workflow is easier for a business analyst to understand, but being procedural it requires more code and is less compact than a state model. But workflow and the state machine are not mutually exclusive, and when used in concert, they can produce powerful solutions.

WebLogic Integration's BPM has four capabilities that are essential to a process-oriented application:

  • Worklist: Human beings are often the key actors in a business process, not only as the source of events that drive the process, but also as participants in the actual processing. The BPM worklist enables a workflow to assign a work task to a user or role and track its progress.
  • Integration: Besides human beings, external systems do much of the work in a process-oriented application. For example, in an insurance application ADP is called to cut a check for payment on the claim. Integration is what WebLogic Integration is all about.
  • XML: Information exchanged between workflow and external systems or users is usually in the form of XML documents. BPM provides abundant XML facilities, including transformations and the ability to listen for events satisfying XPath or XQuery expressions.
  • Events and timers: Process-oriented applications live a long time but spend most of their time asleep. Events and timers wake them up, whereupon workflows do work and possibly change state. Events and timers are built into BPM.
When these features are incorporated into an enterprise state machine framework, the result is a powerful synthesis that is ideal for process-oriented application development. The pieces of this solution are the following:
  1. A state machine framework, consisting of:
    - State model: A model is a set of states and transitions, expressed in an XML document.
    - Actor database: An actor is an entity that has state. The state of the actor is persisted to a database by the state machine.
    - State machine engine: The engine injects events into an actor's state model and updates state accordingly. It also calls user-defined action classes when a state is entered or exited or a transition occurs.
    - Action classes: User-defined Java classes that respond to the entry or exit of a state or the execution of a transition for an actor in a given state model.
  2. A BPM workflow that receives an event and injects it into the state machine.
  3. A BPM workflow that sets a timer and injects a timeout event into the state machine when the timer expired.
  4. A BPM workflow that is called by a state action to assign a worklist task or interact with an external system.
The insurance example is a perfect example. The state model for the application, a formalization of Figure 1, is shown in Listing 1. The XML indicates that there are seven states (e.g., "top", "idle", "proposed", "accepted") and multiple transitions (such as "approved" from the state "escalated" to the state "accepted").

The "actor" to which this state model applies is an insurance claim. An actor is identified by a unique identifier, perhaps in this case a numeric claim ID. The action class has the behavior shown in Table 1.

 

The corresponding BPM workflows are as follows:

  • Timer flow: Starts a timer for a specified interval. If the timer expires, the workflow fires an XML timeout event. This workflow also listens for a cancellation event that causes it to stop the timer. Figure 4 shows this workflow for WebLogic Integration 8.1.

     

  • Task assignment flow: Assigns a task to a given user or role and waits for the user's response. Based on the response, this workflow generates an XML event bound for the state machine. The WebLogic Integration 8.1 implementation is shown in Figure 5.

     

  • State injector: All XML events bound for the state machine are intercepted by this workflow, which in turn calls the state machine via its API to inject an event. Figure 6 shows the injector workflow in WebLogic Integration 8.1

     

  • Cleanup: The cleanup workflow performs whatever steps are necessary to finalize a claim, such as cutting a rejection letter or an acceptance letter with a check.
Conclusion
Process-oriented enterprise applications abound, and workflow toolsets, such as BEA WebLogic Integration's BPM, are viable and popular frameworks to develop them. However, the state machine approach is also valid, and has particular advantages when coupled with BPM. My next article will look at E-State, a reference implementation of an enterprise state machine framework that is meant to coexist with BPM.

More Stories By Michael Havey

Michael Havey is a Chordiant consultant with 10 years of industry experience, mostly with application integration. Michael's book Essential Business Process Modeling was published by O'Reilly in August 2005.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


@ThingsExpo Stories
Cloud Expo | DXWorld Expo have announced the conference tracks for Cloud Expo 2018. Cloud Expo will be held June 5-7, 2018, at the Javits Center in New York City, and November 6-8, 2018, at the Santa Clara Convention Center, Santa Clara, CA. Digital Transformation (DX) is a major focus with the introduction of DX Expo within the program. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive ov...
In his session at 21st Cloud Expo, Raju Shreewastava, founder of Big Data Trunk, provided a fun and simple way to introduce Machine Leaning to anyone and everyone. He solved a machine learning problem and demonstrated an easy way to be able to do machine learning without even coding. Raju Shreewastava is the founder of Big Data Trunk (www.BigDataTrunk.com), a Big Data Training and consulting firm with offices in the United States. He previously led the data warehouse/business intelligence and B...
A strange thing is happening along the way to the Internet of Things, namely far too many devices to work with and manage. It has become clear that we'll need much higher efficiency user experiences that can allow us to more easily and scalably work with the thousands of devices that will soon be in each of our lives. Enter the conversational interface revolution, combining bots we can literally talk with, gesture to, and even direct with our thoughts, with embedded artificial intelligence, whic...
To get the most out of their data, successful companies are not focusing on queries and data lakes, they are actively integrating analytics into their operations with a data-first application development approach. Real-time adjustments to improve revenues, reduce costs, or mitigate risk rely on applications that minimize latency on a variety of data sources. In his session at @BigDataExpo, Jack Norris, Senior Vice President, Data and Applications at MapR Technologies, reviewed best practices to ...
"Digital transformation - what we knew about it in the past has been redefined. Automation is going to play such a huge role in that because the culture, the technology, and the business operations are being shifted now," stated Brian Boeggeman, VP of Alliances & Partnerships at Ayehu, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
SYS-CON Events announced today that Synametrics Technologies will exhibit at SYS-CON's 22nd International Cloud Expo®, which will take place on June 5-7, 2018, at the Javits Center in New York, NY. Synametrics Technologies is a privately held company based in Plainsboro, New Jersey that has been providing solutions for the developer community since 1997. Based on the success of its initial product offerings such as WinSQL, Xeams, SynaMan and Syncrify, Synametrics continues to create and hone inn...
"Evatronix provides design services to companies that need to integrate the IoT technology in their products but they don't necessarily have the expertise, knowledge and design team to do so," explained Adam Morawiec, VP of Business Development at Evatronix, in this SYS-CON.tv interview at @ThingsExpo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
The 22nd International Cloud Expo | 1st DXWorld Expo has announced that its Call for Papers is open. Cloud Expo | DXWorld Expo, to be held June 5-7, 2018, at the Javits Center in New York, NY, brings together Cloud Computing, Digital Transformation, Big Data, Internet of Things, DevOps, Machine Learning and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding busin...
In his Opening Keynote at 21st Cloud Expo, John Considine, General Manager of IBM Cloud Infrastructure, led attendees through the exciting evolution of the cloud. He looked at this major disruption from the perspective of technology, business models, and what this means for enterprises of all sizes. John Considine is General Manager of Cloud Infrastructure Services at IBM. In that role he is responsible for leading IBM’s public cloud infrastructure including strategy, development, and offering m...
Nordstrom is transforming the way that they do business and the cloud is the key to enabling speed and hyper personalized customer experiences. In his session at 21st Cloud Expo, Ken Schow, VP of Engineering at Nordstrom, discussed some of the key learnings and common pitfalls of large enterprises moving to the cloud. This includes strategies around choosing a cloud provider(s), architecture, and lessons learned. In addition, he covered some of the best practices for structured team migration an...
Recently, REAN Cloud built a digital concierge for a North Carolina hospital that had observed that most patient call button questions were repetitive. In addition, the paper-based process used to measure patient health metrics was laborious, not in real-time and sometimes error-prone. In their session at 21st Cloud Expo, Sean Finnerty, Executive Director, Practice Lead, Health Care & Life Science at REAN Cloud, and Dr. S.P.T. Krishnan, Principal Architect at REAN Cloud, discussed how they built...
No hype cycles or predictions of a gazillion things here. IoT is here. You get it. You know your business and have great ideas for a business transformation strategy. What comes next? Time to make it happen. In his session at @ThingsExpo, Jay Mason, an Associate Partner of Analytics, IoT & Cybersecurity at M&S Consulting, presented a step-by-step plan to develop your technology implementation strategy. He also discussed the evaluation of communication standards and IoT messaging protocols, data...
SYS-CON Events announced today that Evatronix will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Evatronix SA offers comprehensive solutions in the design and implementation of electronic systems, in CAD / CAM deployment, and also is a designer and manufacturer of advanced 3D scanners for professional applications.
With tough new regulations coming to Europe on data privacy in May 2018, Calligo will explain why in reality the effect is global and transforms how you consider critical data. EU GDPR fundamentally rewrites the rules for cloud, Big Data and IoT. In his session at 21st Cloud Expo, Adam Ryan, Vice President and General Manager EMEA at Calligo, examined the regulations and provided insight on how it affects technology, challenges the established rules and will usher in new levels of diligence arou...
Smart cities have the potential to change our lives at so many levels for citizens: less pollution, reduced parking obstacles, better health, education and more energy savings. Real-time data streaming and the Internet of Things (IoT) possess the power to turn this vision into a reality. However, most organizations today are building their data infrastructure to focus solely on addressing immediate business needs vs. a platform capable of quickly adapting emerging technologies to address future ...
22nd International Cloud Expo, taking place June 5-7, 2018, at the Javits Center in New York City, NY, and co-located with the 1st DXWorld Expo will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud ...
22nd International Cloud Expo, taking place June 5-7, 2018, at the Javits Center in New York City, NY, and co-located with the 1st DXWorld Expo will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud ...
DevOps at Cloud Expo – being held June 5-7, 2018, at the Javits Center in New York, NY – announces that its Call for Papers is open. Born out of proven success in agile development, cloud computing, and process automation, DevOps is a macro trend you cannot afford to miss. From showcase success stories from early adopters and web-scale businesses, DevOps is expanding to organizations of all sizes, including the world's largest enterprises – and delivering real results. Among the proven benefits,...
@DevOpsSummit at Cloud Expo, taking place June 5-7, 2018, at the Javits Center in New York City, NY, is co-located with 22nd Cloud Expo | 1st DXWorld Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is no time to wait...
SYS-CON Events announced today that T-Mobile exhibited at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. As America's Un-carrier, T-Mobile US, Inc., is redefining the way consumers and businesses buy wireless services through leading product and service innovation. The Company's advanced nationwide 4G LTE network delivers outstanding wireless experiences to 67.4 million customers who are unwilling to compromise on qua...