jBPM、并发执行和流程变量
当 jBPM 中的流程分叉为并发路径时,每个路径都会获得自己的流程变量副本,以便它们彼此隔离运行。
但是当路径再次连接时会发生什么? 显然,可能存在冲突的更新。 上下文是否恢复到分叉之前的状态? 我可以选择从单独的轨道复制单个变量吗?
When a process in jBPM forks into concurrent paths, each of these paths gets their own copy of the process variables, so that they run isolated from each other.
But what happens when the paths join again ?
Obviously there could be conflicting updates.
Does the context revert back to the state before the fork?
Can I choose to copy individual variables from the separate tracks?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为您必须配置任务的任务控制器。 在某些情况下,以不会导致冲突的方式设置
access
属性就足够了(例如对第一个路径的read
访问权限和read,write< /code> 访问第二条路径)。 如果不是这种情况,那么您可以实现自己的
TaskControllerHandler
并使用自定义逻辑实现方法void SubmitTaskVariables(TaskInstance taskInstance, ContextInstance contextInstance, Token token)
。 请参阅:任务控制器。I think that you have to configure the Task Controllers of your tasks. In some cases it is enough to set the
access
attribute in a way that does not result in conflicts (e.g.read
access to the first path andread,write
access to the second path). If this is not the case then you can implement your ownTaskControllerHandler
and implement the methodvoid submitTaskVariables(TaskInstance taskInstance, ContextInstance contextInstance, Token token)
with your custom logic. Please see: Task Controllers.我尝试了一个小实验:
最后我可以访问三个变量:shared、right 和“fromRight”,这些变量是由脚本针对父级显式设置的。
共享变量从右侧分支获取其值,左侧所做的更改似乎消失了。
请注意,转换对我来说实际上并不是异步的,整个实验将在一个事务中运行,这些因素可能会影响结果
I tried a little experiment:
At the end I had access to three variables, shared, right and "fromRight" which was set by the script against the parent explicitly.
The shared variable took its value from the right fork, changes made on the left seemed to dissappear.
Note that the transitions aren't actually asynchronous for me, and the whole experiment will have run in one transaction, these factors may affect the outcome