jBPM-4.0 Chinese Development Guide-Chapter 13th execution mode

Source: Internet
Author: User
Tags bind jbpm

Chapter 13th Implementation Mode

There are three basic process execution modes: objects, persistence, and embedding. For persistent and embedded execution patterns, process execution must be performed in a single transaction. In that case, the process execution must be placed inside an environment. The environment is used to bind process execution and update to a transaction that applies transactions. Environments can be used to bind, such as a JDBC connection, jta,bmt,spring transactions, and so on.

13.1. Object Execution Mode

Object execution mode is the simplest form of using a process virtual machine. This means that the process definition and execution objects are used directly through the client API. Let's illustrate this with an example. We start by creating a clientprocessdefinition that looks like this:

Object execution mode is the simplest form of using a process virtual machine. This means that the process definition and execution objects are used directly through the client API. Let's illustrate this with an example. We start by creating a clientprocessdefinition that looks like this:

Figure 13.1. Loan process

ClientProcessDefinition processDefinition = ProcessFactory.build("loan")
  .activity("submit loan request").initial().behaviour(AutomaticActivity.class)
    .transition().to("evaluate")
  .activity("evaluate").behaviour(WaitState.class)
     .transition("approve").to("wire money")
    .transition("reject").to("end")
  .activity("wire money").behaviour(AutomaticActivity.class)
    .transition().to ("archive")
  .activity("archive").behaviour(WaitState.class)
    .transition ().to("end")
  .activity("end").behaviour(WaitState.class)
.done();

Processfactory is a helper class that facilitates the construction of an object graph that behaves as a process definition. Automaticactivity is an activity through which no operation occurs, and Waitstate will wait until the external signal occurs. The implementation of both activities will be discussed further later.

The ProcessDefinition object acts as a factory, as a process instance object. A process instance behaves as an execution of a process definition. More precisely, the process instance is the main path of execution.

Clientexecution execution = processdefinition.startprocessinstance ();

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.