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

Related Topics: Weblogic

Weblogic: Article

E-State: An Enterprise State Machine

A framework inspired by ROOM

E-State and Workflow
Workflow and state machines are, as argued in my earlier article, "State Machines and Workflow" (WLDJ, Vol. 3, issue 1), complementary implementation strategies for process-oriented applications. The state approach is a powerful abstraction for the succession of milestones found in many business processes. On the other hand, workflow - in particular, the Business Process Modeler (BPM) component of BEA WebLogic Integration - provides important enterprise-level services, such as external system integration, human worklist and task management, events and timers, and XML messaging processing. As the earlier article pointed out, a hybrid state-workflow solution has the following parts:

  1. A state machine framework, consisting of:
    - A state model: A set of states and transitions, expressed in an XML document.
    - Actor database: An entity that has state. The state of the actor is persisted to a database by the state machine.
    - State machine 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.
E-State is a reference implementation of the first part: the state machine framework. This article discusses its architecture.

E-State Architecture

E-State's state models are based on those in the Real-time Object-Oriented Modeling (ROOM) methodology. ROOM state charts are hierarchical, meaning that a given state can have substates. This simple idea is disproportionately powerful. Flat state models simply don't scale from a human understanding point of view. As the number of states and transitions increases, the flat model becomes too hard to comprehend. Hierarchical state models can be understood in pieces, each piece being relatively simple to conceive. For example, consider Figure 1.


In this model the transition ab leads either of states a1 or a2 to state b; similarly, the transition ac causes the state to change from a1 or a2 to c. The transition toC for all states causes the state to change to c. Transition ba in state a1 results in the new state b. The initial state is b. The state changes from a1 to a2 on transition a1a2, and from a2 to a1 on a2a1. Transition ca leads to a choice point: if the last a state is a1, it leads to a1, otherwise a2.

The hierarchical version of this scenario, depicted in Figure 2, is easier to understand.


First, states a1 and a2 are factored out as superstate a (right diagram); the overall picture (left diagram) is cleaner. Transitions ab and ba, from the perspective of the top state, simply shift between states a and b; but in state a we see that ba leads to substate a1, whereas ab originates from a1. The transition ac leads from either a1 or a2 to c; the transition ca leads from c to the last substate of a. In addition, the toC transition no longer needs to originate from each state; to event from the top state's nonextending transition point toC to state c satisfies the intended behavior.

As a consequence of its hierarchical design, ROOM offers two powerful features: group transitions and transitions to history. A group transition is one that occurs for a given state no matter what substate it is in; transition ac leads from state a to c regardless of whether a's substate is a1 or a2. A transition to history is a transition into the most recent substate of a given state; transition ca brings state c to the last substate of a.

Alternative methodologies are UML and Petri-nets, each of which supports hierarchical structures.

The heart of E-State is a stateless session Enterprise JavaBean (EJB) called StateMachine, which is shaded in the diagram in Figure 3.


The StateMachine EJB is configured to point to a particular state model, which is an XML file specifying, for a given application, the following:

  • A set of states and a set of transitions
  • A unique namespace, which enables multiple deployments, as discussed below
  • The name of the Java "action'' callback class that the state machine invokes while processing an event
The EJB applies the model to "actors." An actor, in ROOM methodology, is an "active" object whose behavior is best described with a state model. (In ROOM, an active object also has its own control thread of and its own set of inbound and outbound messaging interfaces. E-State's notion of an actor is more restrictive.) In E-State, an actor is an entity that has state, such as an insurance claim. The transition from one state to another in a model reflects the change in state of the actor; for example, a claim can be waiting, activated, or idle. E-State has three tables that track the state of an actor, namely Actor, Actor_Property, and Actor_State, and has corresponding entity EJBs (Actor, ActorProperty, and ActorState) to represent them, as shown in Figure 3. The StateMachine EJB is in part a facade to these entity EJBs; its actor-management methods include createActor(), getCurrentState(), getChildState(), getActorProperty(), getActorProperties() and setActorProperty().

The remaining methods of StateMachine (startMachine() and injectEvent()) constitute the engine that drives an actor's change of state. Actually, startMachine(), simply calls injectEvent(), passing the special "initial" event type to it, to execute the transitions originating from the initial transition points of each state in the model. The injectEvent() method, then, is the heart of the machine that moves the action of the business process along. This method invokes methods of the user-defined action class along the way, implementing the interface StateAction that is defined with the model. The purpose of the action class is to notify the client of important state machine events and to request logical decisions. The methods of the action class are shown in Table 1.


In the insurance example, action classes start workflows to perform task-related or cleanup work, or to start a timer. In WebLogic Integration 7.0, a workflow is started with the BPM API. In WebLogic Integration 8.1, the workflow is called as a Web service.

The methods of the StateMachine EJB are summarized in Table 2.


In the insurance example, the injector workflow calls the injectEvent() of the state machine. In WebLogic Integration 7.0, the workflow uses a business operation to call this method. In WebLogic Integration 8.1, it uses an EJB control.

Database Schema
Figure 4 shows the structure of tables to hold persistent actor state information.


The main table, Actor, stores the current state of an actor for a particular model type. The current state is the leaf state that the actor is currently in. The primary key is a combination of the actor's unique identifier and its model namespace. An actor can have state in several model namespaces. Notably, if two versions of a model exist with distinct namespaces, the actor's state in each can be represented in the actor table.

The Actor_State table captures the active substate of each composite state of a given actor in a given namespace. This table is for internal use only; the engine uses it to process transitions to history. There is a one-to-many relationship between actor and actor_state.

The Actor_Property table stores user-defined properties for an actor in a given namespace. A property has a name (which is unique per actor per namespace), a type, and a value. This table is provided as a convenience to client applications to associate a set of data with an actor; more likely, that data is held in an application-specific data store.

A different instance of the StateMachine EJB is deployed for each state model. The source code is the same for each (same home and remote interfaces, same implementation), but the configuration is different. The deployment descriptor for the EJB specifies a unique Java Naming and Directory Interface (JNDI) name (which clients use to locate EJB), as well as a reference to an XML file containing the model itself. For example, the StateMachine EJB for the insurance state model might have the JNDI name "state_insurance" and point to file "Insurance.xml". To interact with this model, a client application accesses its EJB with the "state-insurance" JNDI name and calls its methods. This peculiar approach has significant advantages:

  • Life cycle: To make a new state model available for processing means to deploy a StateMachine EJB that points to it. To decommission that model means to undeploy that EJB. To promote a change to the model means to redeploy the EJB with the modified model file.
  • Versioning: If an existing state model has a new major version, the new version can be deployed as a separate EJB and coexist with the earlier version. For example, "state-insurance-1.1" can coexist with "state-insurance".
The data model is also conducive to versioning. A given actor can have persistent state for multiple models, including different versions of the same model, as long as the models have distinct names.

Most business processes run for a long time, which makes the management of application upgrades especially challenging. Two scenarios are hard to solve:

  1. A minor patch where there are actors in progress on the unpatched release.
  2. A major patch meant only for new actors; old actors are to continue with the earlier version.
E-State is an intelligent solution to these problems:
  1. Applying the minor patch means redeploying the existing EJB for that model. The actors will pick up where they left off, but with the patch in place.
  2. Applying the major patch means deploying a new EJB with a distinct namespace, but keeping the existing EJB deployed as is. The models are independent, allowing old actors to continue with the earlier release while new actors use the new release.
E-State is an enterprise state machine framework inspired by the ROOM methodology that, when combined with BPM workflows offering key integration services such as systems integration, events, timers, worklist, and XML, provides powerful solutions for development of process-oriented business applications. E-State includes a runtime engine, a schema for state models, persistence services, and user-defined "action" classes, which are invoked by the engine when a transition occurs, or when a state is entered or exited. The action classes likely call workflows to leverage BPM services; workflows, in turn, when triggered by events, call the engine to trigger transitions.


  • Selic, Gullickson, and Ward. (1994). Real-Time Object-Oriented Modeling. Wiley.
  • 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
    Digital Transformation and Disruption, Amazon Style - What You Can Learn. Chris Kocher is a co-founder of Grey Heron, a management and strategic marketing consulting firm. He has 25+ years in both strategic and hands-on operating experience helping executives and investors build revenues and shareholder value. He has consulted with over 130 companies on innovating with new business models, product strategies and monetization. Chris has held management positions at HP and Symantec in addition to ...
    Cloud-enabled transformation has evolved from cost saving measure to business innovation strategy -- one that combines the cloud with cognitive capabilities to drive market disruption. Learn how you can achieve the insight and agility you need to gain a competitive advantage. Industry-acclaimed CTO and cloud expert, Shankar Kalyana presents. Only the most exceptional IBMers are appointed with the rare distinction of IBM Fellow, the highest technical honor in the company. Shankar has also receive...
    Enterprises have taken advantage of IoT to achieve important revenue and cost advantages. What is less apparent is how incumbent enterprises operating at scale have, following success with IoT, built analytic, operations management and software development capabilities - ranging from autonomous vehicles to manageable robotics installations. They have embraced these capabilities as if they were Silicon Valley startups.
    Poor data quality and analytics drive down business value. In fact, Gartner estimated that the average financial impact of poor data quality on organizations is $9.7 million per year. But bad data is much more than a cost center. By eroding trust in information, analytics and the business decisions based on these, it is a serious impediment to digital transformation.
    The standardization of container runtimes and images has sparked the creation of an almost overwhelming number of new open source projects that build on and otherwise work with these specifications. Of course, there's Kubernetes, which orchestrates and manages collections of containers. It was one of the first and best-known examples of projects that make containers truly useful for production use. However, more recently, the container ecosystem has truly exploded. A service mesh like Istio addr...
    Predicting the future has never been more challenging - not because of the lack of data but because of the flood of ungoverned and risk laden information. Microsoft states that 2.5 exabytes of data are created every day. Expectations and reliance on data are being pushed to the limits, as demands around hybrid options continue to grow.
    Business professionals no longer wonder if they'll migrate to the cloud; it's now a matter of when. The cloud environment has proved to be a major force in transitioning to an agile business model that enables quick decisions and fast implementation that solidify customer relationships. And when the cloud is combined with the power of cognitive computing, it drives innovation and transformation that achieves astounding competitive advantage.
    As IoT continues to increase momentum, so does the associated risk. Secure Device Lifecycle Management (DLM) is ranked as one of the most important technology areas of IoT. Driving this trend is the realization that secure support for IoT devices provides companies the ability to deliver high-quality, reliable, secure offerings faster, create new revenue streams, and reduce support costs, all while building a competitive advantage in their markets. In this session, we will use customer use cases...
    Digital Transformation: Preparing Cloud & IoT Security for the Age of Artificial Intelligence. As automation and artificial intelligence (AI) power solution development and delivery, many businesses need to build backend cloud capabilities. Well-poised organizations, marketing smart devices with AI and BlockChain capabilities prepare to refine compliance and regulatory capabilities in 2018. Volumes of health, financial, technical and privacy data, along with tightening compliance requirements by...
    The best way to leverage your Cloud Expo presence as a sponsor and exhibitor is to plan your news announcements around our events. The press covering Cloud Expo and @ThingsExpo will have access to these releases and will amplify your news announcements. More than two dozen Cloud companies either set deals at our shows or have announced their mergers and acquisitions at Cloud Expo. Product announcements during our show provide your company with the most reach through our targeted audiences.
    DevOpsSummit New York 2018, colocated with CloudEXPO | DXWorldEXPO New York 2018 will be held November 11-13, 2018, in New York City. Digital Transformation (DX) is a major focus with the introduction of DXWorldEXPO 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 over the long term. A total of 88% of Fortune 500 companies from a generation ago are now out of bus...
    With 10 simultaneous tracks, keynotes, general sessions and targeted breakout classes, @CloudEXPO and DXWorldEXPO are two of the most important technology events of the year. Since its launch over eight years ago, @CloudEXPO and DXWorldEXPO have presented a rock star faculty as well as showcased hundreds of sponsors and exhibitors! In this blog post, we provide 7 tips on how, as part of our world-class faculty, you can deliver one of the most popular sessions at our events. But before reading...
    DXWordEXPO New York 2018, colocated with CloudEXPO New York 2018 will be held November 11-13, 2018, in New York City and will bring together Cloud Computing, FinTech and Blockchain, Digital Transformation, Big Data, Internet of Things, DevOps, AI, Machine Learning and WebRTC to one location.
    DXWorldEXPO LLC announced today that ICOHOLDER named "Media Sponsor" of Miami Blockchain Event by FinTechEXPO. ICOHOLDER give you detailed information and help the community to invest in the trusty projects. Miami Blockchain Event by FinTechEXPO has opened its Call for Papers. The two-day event will present 20 top Blockchain experts. All speaking inquiries which covers the following information can be submitted by email to [email protected] Miami Blockchain Event by FinTechEXPO also offers s...
    DXWorldEXPO | CloudEXPO are the world's most influential, independent events where Cloud Computing was coined and where technology buyers and vendors meet to experience and discuss the big picture of Digital Transformation and all of the strategies, tactics, and tools they need to realize their goals. Sponsors of DXWorldEXPO | CloudEXPO benefit from unmatched branding, profile building and lead generation opportunities.
    Dion Hinchcliffe is an internationally recognized digital expert, bestselling book author, frequent keynote speaker, analyst, futurist, and transformation expert based in Washington, DC. He is currently Chief Strategy Officer at the industry-leading digital strategy and online community solutions firm, 7Summits.
    The IoT Will Grow: In what might be the most obvious prediction of the decade, the IoT will continue to expand next year, with more and more devices coming online every single day. What isn’t so obvious about this prediction: where that growth will occur. The retail, healthcare, and industrial/supply chain industries will likely see the greatest growth. Forrester Research has predicted the IoT will become “the backbone” of customer value as it continues to grow. It is no surprise that retail is ...
    Andrew Keys is Co-Founder of ConsenSys Enterprise. He comes to ConsenSys Enterprise with capital markets, technology and entrepreneurial experience. Previously, he worked for UBS investment bank in equities analysis. Later, he was responsible for the creation and distribution of life settlement products to hedge funds and investment banks. After, he co-founded a revenue cycle management company where he learned about Bitcoin and eventually Ethereal. Andrew's role at ConsenSys Enterprise is a mul...
    DXWorldEXPO LLC announced today that "Miami Blockchain Event by FinTechEXPO" has announced that its Call for Papers is now open. The two-day event will present 20 top Blockchain experts. All speaking inquiries which covers the following information can be submitted by email to [email protected] Financial enterprises in New York City, London, Singapore, and other world financial capitals are embracing a new generation of smart, automated FinTech that eliminates many cumbersome, slow, and expe...
    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...