问题标签 [spring-statemachine]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
5792 浏览

java - Spring 状态机的替代方案

我已经将 Spring 状态机与一些基本的 Spring MVC 应用程序一起使用。我不得不承认,它很容易配置和使用。

但它也有许多局限性,主要是因为它处于开发的早期阶段。

我还遇到了一些工作流引擎,比如Activiti,它是一个用 Java 编写的开源工作流引擎stateless4j,它是一个轻量级 Java 状态机。它们看起来更加精致和精致。

我想知道这些和 Spring State Machine 有什么区别(优点或缺点)。

0 投票
1 回答
147 浏览

spring-statemachine - 使用注解时的错误处理

我正在按照文档(状态机错误处理)来实现错误处理。但是,当发生异常时,它会向上传播而不是被拦截。我尝试使用拦截器、监听器和@OnStateMachineError没有任何成功。调试代码时,MethodInvokingStateMachineRuntimeProcessor.java:52它的调用者或任何调用者都没有任何特定的逻辑来处理错误。

复制问题很简单,只需创建一个状态机(我使用的是最新的快照)并注册 bean:

我错过了什么还是真正的错误?如果是这样,我会提出一个问题

0 投票
1 回答
551 浏览

spring-statemachine - Create a StateMachineInterceptor to persist StateMachineContext

I'm struggling to persist my state machine following the recipes and examples available. I'm working with the master branch and my state machine uses Hierarchical States, Regions and Orthogonal states. The first example I followed is spring-statemachine-samples/persist but it seems to deal only with basic FSM. The second one I tried is LocalStateMachineInterceptor but id does not seem to be working with Hierarchical States. Also, I can't find any way to persist an history state via a StateMachinePersist.

Is there an example of a complex FSM with persistence anywhere?

0 投票
1 回答
6540 浏览

java - 如何将 Spring 状态机用于 Order 对象

我正在尝试在我的项目中使用 Spring State Machine,因为有一个对象Order具有多个状态

  • 新的
  • 有薪酬的
  • 包装好的
  • 发表
  • 取消
  • 回来

该对象可以实现如下

我引入了OrderService,从DB获取订单,设置一些信息,包括OrderState,然后保存到DB。

但是我不知道如何将 Spring 状态机应用到这个状态机中,使用这样的简单目的是否太复杂了?

0 投票
1 回答
153 浏览

spring-statemachine - 如果使用 Builder,AbstractStateMachine.java:591 中的 NullPointerException

下面的代码给我一个 NPE,我不知道出了什么问题。我找不到初始化 currentState 的代码。有人可以帮忙吗?

}

我正在使用:org.springframework.statemachine:spring-statemachine-core:1.1.0.M2

谢谢弗雷迪

0 投票
1 回答
420 浏览

persist - Spring statemachine Persist Statecontext

在参考文档中有一个用于持久化状态机的示例:

http://docs.spring.io/autorepo/docs/spring-statemachine/1.0.0.M3/reference/htmlsingle/#statemachine-recipes-persist

http://docs.spring.io/autorepo/docs/spring-statemachine/1.0.0.M3/reference/htmlsingle/#statemachine-examples-persist

有谁知道,如果有办法持久化 stateContext 吗?

谢谢弗雷迪

0 投票
1 回答
516 浏览

spring - Spring Statemachine - 自动流

在我的项目中,我基本上有这些状态:

S1、S2、S3、S4

当我发送事件 E1 时,会转换到 S2。现在基于一个选择,要么将状态更改为 S3,要么保持在 S2。当转换到 S3 -> 我想再次自动转发到 S4 或留在 S3,没有任何新事件。

知道怎么做吗?

0 投票
2 回答
3144 浏览

spring-statemachine - 动态配置弹簧状态机

关于弹簧状态机的一些查询。

  1. 我们能否在一个 spring 项目中拥有多个状态机,其中一个状态机用于一个工作流程(可能是 CD 播放器工作流程),另一个用于旋转门?

  2. 我可以在我的配置类中动态加载配置吗,例如从具有 JSON 格式数据的大数据源中加载我们的状态、事件、转换等。

  3. 我的要求之一是我可能有一个经常变化的工作流或模型,我需要在我的 spring 项目中进行配置。如何使用弹簧状态机有效地做到这一点。

0 投票
1 回答
4533 浏览

java - 多线程环境中的弹簧状态机

我们刚刚开始使用弹簧状态机。有几个问题:

  • 每个状态机的状态上下文是否只有一次?
  • 传递给状态机的事件是否以阻塞方式运行?有什么方法可以让它们并行运行,比如每次触发事件时提供一个新的状态机?

这是我的代码:

配置状态和转换:

在状态转换期间提供操作:

任务执行者:

以及传递给状态机的事件:

0 投票
1 回答
413 浏览

spring-statemachine - AbstractStateMachine.acceptEvent 方法中的 NullPointerException 错误

下面是我的一个类项目,它使用的是 spring-statemachine-core-1.0.2.RELEASE-sources.jar,它实现了从一种状态到另一种状态的简单转换。它在AbstractStateMachine.acceptEvent方法中的currentState上咳出空指针异常。感谢帮助/想法。

org.springframework.statemachine.support.AbstractStateMachine.acceptEvent 的 java.lang.NullPointerException(AbstractStateMachine.java:591)