Interface FlowInstanceService
- All Known Implementing Classes:
DefaultFlowInstanceService
public interface FlowInstanceService
Flow-instance facade: start, get, list, terminate.
流程实例门面:启动、查询、列表、终止。
- Since:
- JDK 25, opencode-base-flow V1.0.5
- Author:
- Leon Soo
-
Method Summary
Modifier and TypeMethodDescriptionfindByInitiator(String userId, int page, int size) Paginated list of instances started by the given user.Returns the instance by id (or throws INST_NOT_FOUND).Start a new instance for the given business key.voidTerminate the running instance (out-of-band).
-
Method Details
-
start
Start a new instance for the given business key. 启动一个新实例。- Parameters:
flowKey- business key — 业务 keyinitiatorId- initiator user id — 发起人variables- business variables (nullable) — 业务变量(可空)- Returns:
- persisted instance — 已持久化实例
- Since:
- JDK 25, opencode-base-flow V1.0.5
-
get
Returns the instance by id (or throws INST_NOT_FOUND). 按 id 返回实例(不存在抛 INST_NOT_FOUND)。- Parameters:
instanceId- instance id — 实例 ID- Returns:
- instance — 实例
- Since:
- JDK 25, opencode-base-flow V1.0.5
-
findByInitiator
Paginated list of instances started by the given user. 分页查询某发起人启动的实例。- Parameters:
userId- initiator user id — 发起人page- zero-based page — 页码(0 起)size- page size — 每页大小- Returns:
- instances on the requested page — 该页实例
- Since:
- JDK 25, opencode-base-flow V1.0.5
-
terminate
Terminate the running instance (out-of-band). Cancels every PENDING task; writes a history record. 终止运行中的实例(外部操作)。取消所有 PENDING task;写一条 history。- Parameters:
instanceId- instance id — 实例 IDoperatorId- operator user id — 操作人reason- reason (nullable) — 理由- Since:
- JDK 25, opencode-base-flow V1.0.5
-