BPM Process Instances – Faults, Rollback Recovery – Part 2

2023-11-01 20:08

本文主要是介绍BPM Process Instances – Faults, Rollback Recovery – Part 2,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

BPM Process Instances – Faults, Rollback & Recovery – Part 2

Introduction

This is part 2 of a 4 part blog explaining how the BPM engine functions under the covers when “faults” occur, be they unhandled technical faults or failures at the engine level.

Part 1 can be found here.

Part 2: Understanding BPM Messages, Threads & Transactions

Given SOA Suite & BPM’s ability to control timeouts and to handle faults, why do we need to understand any further inside the BPM engine ?

Well, there are always going to be exceptional circumstances, such as runtime errors in the engine itself (e.g. NullPointerExceptions) caused by internal or external events (Out of Memory, stuck threads etc.) and alongside this is the likelihood that however thorough the testing carried out there will be some unforeseen scenarios that have not been handled appropriately in the design. In both of these circumstances the affected instances will need to be recovered somehow, and we’ll now look at how the BPM engine handles threads and how failed instances can be recovered.

As an introduction to this topic I would advise the excellent presentation by David Read (BPM PM) found here.

Local Optimization

It is important to understand the concept of “local optimization” in SOA Suite… essentially this will be enabled by default and means that any service calls which remain within the same weblogic cluster will be optimized to be routed to the same weblogic managed server instance, i.e. there will be no routing out via the load balancer and no HTTP/SOAP, all calls will be optimized to be java calls and therefore use the same thread as the client.

BPM Process Patterns

In order to better demonstrate messages & threading inside the BPM engine we will use the following three common process interaction patterns….

Pattern 1 – Async – Async

This is a very common pattern within BPM, an asynchronous process calls an asynchronous process via a send/receive activity….

BPMR_07

Pattern 2 – Async – Sync

Another common pattern, normally an asynchronous BPM process calling a synchronous SOA service such as a mediator composite in this case….

BPMR_08

Pattern 3 – Async with Acknowledgement – Sync

The final common pattern, again an asynchronous client process calling a synchronous SOA service, but this time the client sends an acknowledgement back to its caller immediately after being invoked in order to notify it that it will continue to process asynchronously…. note that in order to effectively respond with the acknowledgement the process is generally designed with a timer activity to force dehydration and therefore a commit point, otherwise the acknowledgement is not sent back to the client until a further dehydration occurs….

BPMR_09

BPM Process Patterns – Messages & Threads

Now we have seen the patterns we can see how the messages & threads are handled for these within the BPM engine. First let us understand the basics of BPM messages and threads….

BPM Messages

There are essentially two kinds of messages within the BPM engine, “invoke messages” and “callback messages”.

Invoke messages – are what drive a process, an invoke message instantiates an invoker thread which then handles the process instance until a dehydration point, i.e. a “Wait” activity, a “Timer” activity or a “Receive” activity. The invoker thread can be an engine thread or in the case of a synchronous call from a client, the client thread itself.

Callback messages – are messages that asynchronously arrive back in the BPM engine and must be correlated to a running instance, examples are callbacks from the workflow service when a human task has been acted upon, or callbacks from an asynchronous service which has completed.

DLV_MESSAGE, DLV_SUBSCRIPTION & WORK_ITEM Tables

Both of these messages are stored in the SOAINFRA table DLV_MESSAGE which acts as a message tracker for BPM processes and will be the starting point for any recovery scenario we cover later. In the case of “callback” messages a row is also written to the DLV_SUBSCRIPTION table and used to correlate the incoming callback message to the process instance. Note that the actual payload of the message is not stored here, it is stored in XML_DOCUMENT table.

BPMR_10

The important columns here are “CONV_ID” which is a unique identifier for the message, “CONV_TYPE” which identifies whether this message is an invoke or callback message and “STATE” which identifies which identifies whether the message itself has been handled etc…

Also of importance is the WORK_ITEM table which contains information & state of certain BPMN activities, we are interested in this because of timer activities.

BPMR_11

The states we are interested in on these tables are as follows….

BPMR_12

BPMR_13

BPMR_14

Pattern 1 – Async – Async

Let’s look at how this knowledge of messages can be applied to the patterns we’ve seen starting with the standard async-async….

BPMR_15

TX1 – Transaction 1 from the client inserts a message into DLV_MESSAGE of type “INVOKE” and state “UNDELIVERED”

TX2 – Transaction 2 updates the message to state “DELIVERED” and continues until the dehydration point at the “receive” activity, via inserting another message into DLV_MESSAGE of type “INVOKE” for the async service process.

TX3 – Transaction 3 inserts a new message into WORK_ITEM of type “RECEIVE” and state “PENDING” and a message into DLV_SUBSCRIPTION with a state of state “UNRESOLVED”

TX4 – Transaction 4 updates the DLV_MESSAGE to “DELIVERED” and inserts a WORK_ITEM for the timer of state “PENDING”

TX5 – Transaction 5 updates the WORK_ITEM message with state “CLOSED” and continues till the end of the called process.

TX6 – Transaction 6 updates the WORK_ITEM message for the main process to state “CLOSED”, sets the state of the DLV_SUBSCRIPTION table to “HANDLED” and continues till the end of the main process.

We can test this out to see what happens in the relevant tables by giving the “gotoSleep” activity a large value such as 4 minutes and running a test.

During Testing

This is what we see during the test while “gotoSleep” is active….

DLV_MESSAGE

BPMR_16

…i.e. an INVOKE message for each of the “start” activities in the two processes in state “STATE_HANDLED”

WORK_ITEM

BPMR_17

…i.e. a WORK_ITEM for the “Receive” activity in the client process of state “open_pending_complete” and a similar WORK_ITEM for the “gotoSleep” activity with a state “open_pending_complete”

DLV_SUBSCRIPTION

BPMR_18

…i.e. a subscription of state UNRESOLVED for the called service.

After Test Completion

This is what we see once the test has successfully completed….

DLV_MESSAGE

BPMR_19

…i.e. an extra entry for the “end” activity  of type “DLV_MESSAGE” and state “STATE_HANDLED”

WORK_ITEM

BPMR_20

…i.e. both WORK_ITEM entries are now in state “CLOSED_FINALIZED”

DLV_SUBSCRIPTION

BPMR_21

…i.e. the subscription is now in state HANDLED

Pattern 2 – Async – Sync

BPMR_22

TX1 – Transaction 1 from the client inserts a message into DLV_MESSAGE of type “INVOKE” and state “UNDELIVERED”

TX2 – Transaction 2 updates the message to state “DELIVERED” and continues until the end of the process.

Note how “local optimization” affects the threading here… the same java transaction (TX2) is used for everything from the “Start” in the BPM process, through the mediator and DB adapter and back to the “End” activity in the BPM process.

We can test this out to see what happens in the relevant tables by setting the DBSleep stored procedure to sleep for an appropriate amount of time and running a test.

During Testing

This is what we see during the test while the DBSleep stored procedure is sleeping….

DLV_MESSAGE

BPMR_23

…i.e. an INVOKE message for the “start” activity in the process in state “STATE_UNRESOLVED”

Nothing in WORK_ITEM or DLV_SUBSCRIPTION as expected.

After Test Completion

This is what we see once the test has successfully completed….

DLV_MESSAGE

BPMR_24

…i.e. the INVOKE message now has state “STATE_HANDLED”

Pattern 3 – Async with Acknowledgement – Sync

BPMR_25

TX1 – Transaction 1 from the client inserts a message into DLV_MESSAGE of type “INVOKE” and state “UNDELIVERED”

TX2 – Transaction 2 updates the message to state “DELIVERED” and continues until the dehydration point at the “timer” activity.

TX3 – Transaction 3 inserts a new message into WORK_ITEM with state “3 – OPEN_PENDING_COMPLETE”

TX4 – Transaction 4 updates the “WORK_ITEM” row with state “6 – CLOSED_FINALIZED” and continues till the end of the process.

Note how “local optimization” affects the threading here… the same java transaction (TX4) is used for everything from the “CatchEvent” in the BPM process, through the mediator and DB adapter and back to the “End” activity in the BPM process.

We can test this out to see what happens in the relevant tables by setting the DBSleep stored procedure to sleep for an appropriate amount of time and running a test.

During Testing

This is what we see during the test while the DBSleep stored procedure is sleeping….

DLV_MESSAGE

BPMR_26

…i.e. an INVOKE message for the “start” activity in state “STATE_HANDLED”

WORK_ITEM

BPMR_27

…i.e. a WORK_ITEM for the “CatchEvent” timer activity in the client process of state “open_pending_complete

After Test Completion

This is what we see once the test has successfully completed….

DLV_MESSAGE

BPMR_28

…i.e. no difference.

WORK_ITEM

BPMR_29

…i.e. WORK_ITEM enty is now in state “CLOSED_FINALIZED”

Summary

In the second part in the series we have looked at some typical process patterns, the important tables in SOAINFRA and what data is added to these tables as a process instance starts and moves to completion. In the next part we will look at what happens when an uncaught exception occurs and the instances roll back.

这篇关于BPM Process Instances – Faults, Rollback Recovery – Part 2的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/325427

相关文章

Level3 — PART 3 — 自然语言处理与文本分析

目录 自然语言处理概要 分词与词性标注 N-Gram 分词 分词及词性标注的难点 法则式分词法 全切分 FMM和BMM Bi-direction MM 优缺点 统计式分词法 N-Gram概率模型 HMM概率模型 词性标注(Part-of-Speech Tagging) HMM 文本挖掘概要 信息检索(Information Retrieval) 全文扫描 关键词

MySQL record 02 part

查看已建数据库的基本信息: show CREATE DATABASE mydb; 注意,是DATABASE 不是 DATABASEs, 命令成功执行后,回显的信息有: CREATE DATABASE mydb /*!40100 DEFAULT CHARACTER SET utf8mb3 / /!80016 DEFAULT ENCRYPTION=‘N’ / CREATE DATABASE myd

Unity Post Process Unity后处理学习日志

Unity Post Process Unity后处理学习日志 在现代游戏开发中,后处理(Post Processing)技术已经成为提升游戏画面质量的关键工具。Unity的后处理栈(Post Processing Stack)是一个强大的插件,它允许开发者为游戏场景添加各种视觉效果,如景深、色彩校正、辉光、模糊等。这些效果不仅能够增强游戏的视觉吸引力,还能帮助传达特定的情感和氛围。 文档

Vue3图片上传报错:Required part ‘file‘ is not present.

错误 "Required part 'file' is not present" 通常表明服务器期望在接收到的 multipart/form-data 请求中找到一个名为 file 的部分(即文件字段),但实际上没有找到。这可能是因为以下几个原因: 请求体构建不正确:在发送请求时,可能没有正确地将文件添加到 FormData 对象中,或者使用了错误的字段名。 前端代码错误:在前端代码中,可能

Oracle(110)什么是RMAN(Recovery Manager)?

RMAN(Recovery Manager)是Oracle数据库提供的一个高效的备份和恢复工具。它能够简化和自动化复杂的备份和恢复操作,并且提供了强大的功能来确保数据的完整性和安全性。 RMAN 的主要功能 备份数据库:支持全备份、增量备份和归档日志备份。恢复数据库:支持从备份中恢复整个数据库或部分数据。克隆数据库:可以方便地创建数据库的副本。验证备份:确保备份数据的一致性和完整性。管理备份空

C++入门(part 2)

前言 在前文我们讲解了C++的诞生与历史,顺便讲解一些C++的小语法,本文会继续讲解C++的基础语法知识。 1. 缺省参数 1.1缺省参数的概念 缺省参数是声明或定义函数时为函数的参数指定⼀个缺省值。在调⽤该函数时,如果没有指定实参则采⽤该形参的缺省值,否则使用指定的实参。(有些地⽅把缺省参数也叫默认参数) 1.2 缺省参数的分类 缺省参数分为全缺省和半缺省参数,全缺省就是全部形参给

MySQL record 01 part

更改密码: alter user 'root'@'localhost' identified with mysql_native_password by ‘123456’; 注意: 在命令行方式下,每条MySQL的命令都是以分号结尾的,如果不加分号,MySQL会继续等待用户输入命令,直到MySQL看到分号,才会去执行分号前的所有用户输入的语句。包括密码在内,用户名、主机名,都需要使用引

出现 E: Sub-process /usr/bin/dpkg returned an error code (1) 解决方法 (全面分析)

目录 前言1. 问题所示2. 原理分析2.1 第一阶段2.2 第二阶段 3. 解决方法4. 彩蛋4.1 错误不提示,直接卸载4.2 卸载后还是无错误提示 前言 3年前遇到过一个类似的,但是轻松解决,推荐阅读:ubuntu:E: dpkg was interrupted, you must manually run ‘sudo dpkg --configure…解决方法 这回发

【Android studio】 unable to start the daemon process

这几天在做一个安卓桌面项目时,突然发现android studio 不能用了。 提示: 网上的一些方法,要不就是: 1、删除C:\Users\<username>\.gradle 文件夹 2、File Menu - > Invalidate Caches/ Restart->Invalidate and Restart 3、C:\Users\<us

Recovery中常用到的系统函数汇总(一)

最近在研究Android 5.1的recovery升级,发现里面的很多系统函数都不是很熟悉,现在做一下笔记,方便自己及有需要的朋友。 1、库函数 int strcmp(const char *str1, const char *str2) 把 str1 所指向的字符串和 str2 所指向的字符串进行比较。下面的函数跟strcmp类似,返回值情况类似。C 库函数 int strncmp(const