jBPM 6 Documentation ナナメ読みその1

jBPM 6 もやるよー。

http://docs.jboss.org/jbpm/v6.0.1/userguide/

I. Getting Started

1. Overview

1.1. What is jBPM?
1.2. Overview
1.3. Core Engine
1.4. Process Designer
1.5. Data Modeler
1.6. Form Modeler
1.7. Process Instance and Task Management
1.8. Business Activity Monitoring
1.9. Workbench
1.10. Eclipse Developer Tools

2. Getting Started

2.1. Downloads
2.2. Getting Started
2.3. Community
2.4. Sources
2.4.1. License
2.4.2. Source code
2.4.3. Building from source
2.5. Getting Involved

このへんは Drools 6 documentation と同じ

2.5.1. Sign up to jboss.org
2.5.2. Sign the Contributor Agreement
2.5.3. Submitting issues via JIRA
2.5.4. Fork GitHub
2.5.5. Writing Tests
2.5.6. Commit with Correct Conventions
2.5.7. Submit Pull Requests
2.6. What to do if I encounter problems or have questions?

3. jBPM Installer

jBPM 5 と同じく、Eclipse込みのインストーラとスクリーンキャストがあるので、すぐに試せる。

3.1. Prerequisites
3.2. Downloading the Installer
3.3. Demo Setup
3.4. 10-Minute Tutorial using the Workbench
3.5. 10-Minute Tutorial using Eclipse
3.6. Configuration
3.6.1. Playgrounds
3.6.2. Workbench Authentication
3.6.3. Using your own database
3.6.4. jBPM database schema scripts (DDL scripts)
3.6.5. jBPM installer script
3.7. Frequently Asked Questions

4. Examples

4.1. Introduction
4.2. Human Resources Example
4.2.1. The KIE Project: human-resources
4.2.2. Building the Human Resources Example
4.2.3. Create a new Process Instance
4.3. Examples zip

examples.zip って jBPM 6.0.1 のダウンロードには無いと思うんだけど… まあ src.zip の中見ればいいんですけどね。

II. jBPM Core

5. Core Engine API

5.1. Overview
5.2. KieBase

むむ、KieHelper か…。便利かもしれんが、ここでも書いてあるように RuntimeManager 使う方が本筋なので、テストでも RuntimeManager に慣れといた方がいいと思う。

5.3. KieSession
5.3.1. ProcessRuntime
5.3.2. Event Listeners

ノードの実行はメソッドコールのスタックなので、Eventの発生順序が変に見えるかもしれないけど、慣れてね!

WorkingMemoryFileLogger は一定数のイベントが貯まる(デフォルト1000)、もしくは close するまで、ファイルに書き込まないので注意。

5.3.3. Correlation Keys

これちょっと重要。アプリケーションドメインの「ビジネスキー」と ProcessInstanceId をひもづける仕組み。 jBPM 5 ではプロセス変数で勝手によろしくってことになってたけど、コア機能として対応。

5.3.4. Threads
  • parallel gateway などでプロセスが並列実行することと、本当にJavaのマルチスレッド実行することは、全く違う種類の話なので注意。
  • プロセスの並列実行はシングルスレッドで実現される。並列な実行パスも、シリアルに実行される。
  • 時間のかかる処理は asynchronous にすること
5.4. RuntimeManager

jBPM 5 でいろいろ面倒くさかった ksession, task service の取り回しを一気に解決してくれるのが RuntimeManager だ!

Strategy はこの3つ

  • Singleton
  • Per Request
  • Per Process Instance

Per Process Instance がいちばんおすすめだと思われる。

5.4.1. Overview
5.4.2. Strategies

ここの説明よく読んでね。

5.4.3. Usage

ここも大事。これに沿って実装しよう

5.4.4. Configuration

RuntimeEnvironmentBuilder.getDefault() を呼ぶと、 DefaultRuntimeEnvironment が使われる。これは内部で DefaultRegisterableItemsFactory を使う。基本的な LocalHTWorkItemHandler などなどが register される。

5.5. Configuration

システムプロパティ。 jbpm.enable.multi.con など。

6. Processes

このへんは jBPM 5 とあまり変わらない感じ。差分を見つけるのが難しい。

6.1. What is BPMN 2.0
6.2. Process
6.2.1. Creating a process
6.3. Activities
6.3.1. Script task
6.3.2. Service task
6.3.3. User task
6.3.4. Reusable sub-process
6.3.5. Business rule task
6.3.6. Embedded sub-process
6.3.7. Multi-instance sub-process
6.4. Events
6.4.1. Start event
6.4.2. End events
6.4.3. Intermediate events
6.5. Gateways
6.5.1. Diverging gateway
6.5.2. Converging gateway
6.6. Others
6.6.1. Variables
6.6.2. Scripts
6.6.3. Constraints
6.6.4. Timers
6.7. Process Fluent API
6.7.1. Example
6.8. Testing
6.8.1. Unit testing

7. Human Tasks

こっちも jBPM 5 と変わらない。

7.1. Introduction
7.2. Using User Tasks in our Processes
7.3. Data Mappings
7.4. Task Lifecycle
7.5. Task Service and The Process Engine
7.6. Task Service API
7.7. Interacting with the Task Service

8. Persistence and Transactions

ここ重要。

8.1. Process Instance State
8.1.1. Runtime State

In most cases where information about the current execution state of process instances is required, the use of a history log is mostly recommended (see below). In some cases, it might still be useful to for example query the internal database tables directly, but you should only do this if you know what you are doing.

「現在の状態」を知りたいときでも、 history log が基本。

セッションやプロセスインスタンスなどの状態はシリアライズされて永続化されるよ。

セーフポイントで状態は永続化されるよ。

8.2. Audit Log

jBPM 5 でのフィードバックを受け、 jBPM 6 で、history log の情報量(カラム)が増えました。レコード数はガンガン増えるので、メンテナンス注意。

8.2.1. The jBPM Audit data model
8.2.2. Storing Process Events in a Database
8.2.3. Storing Process Events in a JMS queue for further processing
8.3. Transactions

うーん、コード例 jBPM 5 向けじゃないか。RuntimeManager ならもっと簡単。

8.3.1. Container managed transaction

WebSphere では ContainerManagedTransactionManager / ContainerManagedTransactionDisposeCommand 使う

8.4. Configuration
8.4.1. Adding dependencies
8.4.2. Manually configuring the engine to use persistence
8.4.3. Configuring the engine to use persistence using JBPMHelper - for tests only

JBPMHelper はテストプログラムの場合でも、JBPMHelper.startH2Server()、JBPMHelper.setupDataSource() 程度に留めておいて、あとは正式なやりかた(RuntimeManager)で書いた方がいいと思います。