engine_types

package
v0.0.0-...-c54ede3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivatedActivity

type ActivatedActivity interface {
	// 获取流程实例
	GetProcessInstance() ProcessInstance
	// 获取元素
	GetElement() sepc_types.BaseElement
	// 设置活动完成
	Complete()
	// 设置活动失败
	Fail(reason string)
}

type BaseElement

type BaseElement interface {
	// 获取元素
	GetElement() sepc_types.BaseElement
	// 获取元素类型
	GetElementType() sepc_element_types.ElementType
	// 元素唯一Key
	GetKey() string
}

type CallActivity

type CallActivity interface {
	// 设置子流程
	SetChildPIKey(ctx context.Context, piKey string) error
	// 获取子流程
	GetChildPIKey() string
}

type CallActivityManager

type CallActivityManager interface {
}

type ElementManager

type ElementManager interface {
	// 找到所有激活的阻塞元素
	FindActiveElements(ctx context.Context) []sepc_types.BaseElement
	// 创建阻塞消息中间事件
	CreateMessageICE(ctx context.Context, baseElement *event.TIntermediateCatchEvent) (BaseElement, error)
	// 删除阻塞消息中间件事件
	DeleteMessageICE(ctx context.Context, msgICEKey string) error
	// 创建阻塞消息中间事件
	CreateCallActivity(ctx context.Context, baseElement *activity.TCallActivity) (BaseElement, error)
	// 删除阻塞消息中间件事件
	DeleteCallActivity(ctx context.Context, callActivityKey string) error
	// 通过元素ID找到储存阻塞的消息中间事件
	FindOneMessageICE(ctx context.Context, elementID string) (BaseElement, error)
	// 通过元素ID找到储存阻塞的重复活动
	FindOneCallActivity(ctx context.Context, elementID string) (BaseElement, error)
}

未完成元素管理

type MessageSubscription

type MessageSubscription interface {
	GetMessageID() string
	GetMessageName() string
	GetKey() string
}

type MessageSubscriptionManager

type MessageSubscriptionManager interface {
	// 创建一个新的消息订阅
	Create(ctx context.Context, msgElement sepc_types.Message) (MessageSubscription, error)
	// 消费消息订阅
	Consumed(ctx context.Context, msgKey string) error
	// 通过消息ID找到消息订阅
	FindOneByID(ctx context.Context, msgID string) (MessageSubscription, error)
}

type Process

type Process interface {
	// 获取流程数据
	GetRaw() []byte
	// 获取流程详情
	GetDefinitions() (*definitions.TDefinitions, error)
	// 获取流程ID
	GetProcessID() (string, error)
}

流程接口

type ProcessInstance

type ProcessInstance interface {
	// 获取流程唯一Key
	GetKey() string
	// 获取流程实例状态
	GetState() sepc_pi_types.State
	// 获取流程详情
	GetDefinitions() (*definitions.TDefinitions, error)
	// 获取流程实例全局上下文
	GetVariables() map[string]any
	// 获取父级流程实例Key
	GetParentProcessInstanceKey() string
	// 获取阻塞元素管理
	GetElementManager() ElementManager
	// 获取消息订阅管理
	GetMessageSubscriptionManager() MessageSubscriptionManager
	// 设置上下文参数
	SetVariables(variables map[string]any) error
	// 设置父级流程实例
	SetParentProcessInstanceKey(ctx context.Context, key string) error
	// 设置流程实例为激活状态
	SetActive(ctx context.Context) error
	// 设置流程实例为完成状态
	SetCompleted(ctx context.Context) error
	// 设置流程实例为失败状态
	SetFailed(ctx context.Context) error
	// 判断是否存在
	HasScheduledFlow(ctx context.Context, flowID string) bool
	// 获取
	GetScheduledFlows(ctx context.Context) []string
	// 添加flowID到ScheduledFlows 处理并行网关使用
	AppendScheduledFlow(ctx context.Context, flowID string) error
	// 删除flowID到ScheduledFlows 处理并行网关使用
	RemoveScheduledFlow(ctx context.Context, flowID string) error
}

流程实例接口

type ProcessInstanceManager

type ProcessInstanceManager interface {
	// 创建流程实例 ctx 上下文用于未来事务 raw 流程文件数据流 variables 实例上下文
	Create(ctx context.Context, raw []byte, variables map[string]any) (ProcessInstance, error)
	// 通过Key找到流程实例
	FindOneByKey(ctx context.Context, piKey string) (ProcessInstance, error)
}

流程实例管理接口

type ProcessManager

type ProcessManager interface {
	// 创建新流程
	Create(ctx context.Context, raw []byte) (Process, error)
	// 通过流程ID找到对应流程
	FindOneByID(ctx context.Context, processID string) (Process, error)
	// 读取文件夹
	LoadFromEmbed(ctx context.Context, myfs *embed.FS) error
}

流程管理接口

type TaskHandler

type TaskHandler func(acitv ActivatedActivity) error

返回错误代表流程实例失败

type TaskHandlerManager

type TaskHandlerManager interface {
	// 注册 Servcie Task 元素处理函数
	RegisterServiceTaskHandler(taskType string, fun TaskHandler)
	// 获取 Servcie Task 元素处理函数
	GetServiceTaskHandler(taskType string) (TaskHandler, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL