Questions tagged [spring-statemachine]

Spring Statemachine is a framework for application developers to use state machine concepts with Spring applications.

Spring Statemachine aims to provide following features:

  • Easy to use flat one level state machine for simple use cases.
  • Hierarchical state machine structure to ease complex state configuration.
  • State machine regions to provide even more complex state configurations.
  • Usage of triggers, transitions, guards and actions.
  • Type safe configuration adapter.
  • State machine event listeners.
  • Spring IOC integration to associate beans with a state machine.

See also

Spring Statemachine Project Page

283 questions
3
votes
1 answer

Spring State Machine Access to StateContext in eventNotAccepted Listener

I'm new to Spring State Machine. I have used a StateMachineListener for my state machine. How can i access to StateContext in eventNotAccepted method. @Override public void eventNotAccepted(Message event) { }
Amir
  • 652
  • 9
  • 19
3
votes
1 answer

spring state machine in multi threaded environment

We have just started using spring state machine. Have a couple of questions: Is the state context only once per state machine? Do the events passed to the state machine run in a blocking way? Any way to make them run in parallel, like, providing a…
3
votes
1 answer

Spring Statemachine: Action on choice state transition not possible?

It seems that actions added to choice pseudo-states are silently ignored. Doing this: Builder builder = StateMachineBuilder.builder(); StateConfigurer states = builder.configureStates().withStates(); StateMachineTransitionConfigurer transitions =…
Marc
  • 1,812
  • 4
  • 23
  • 36
2
votes
0 answers

Spring State Machine change DefaultStateContext to custom implementation

I write a simple custom implementation of public class AdditionalMethodContext extends DefaultStateContext implements StateContext{ public AdditionalMethodContext(Stage stage, Message message, MessageHeaders…
2
votes
2 answers

Spring Statemachine State Actions vs Transition actions

Spring statemachine provides following type of actions. Can someone please explain me which type of action should be used in which scenario? And, If an action fails then does statemachine move to next state or not? Event action - Action attached to…
super2020
  • 23
  • 4
2
votes
1 answer

Spring State Machine use StateMachineTestPlan to test a withChoice transition

If I have a StateMachine set up as below: transitionConfigurer .withExternal() .source(FIRST) .event(EVENT_1) .target(SECOND) .and() .withChoice() .source(SECOND) .first(THIRD, new Guard(someService)) .last(FIRST) …
rtn
  • 31
  • 1
2
votes
0 answers

Increase thread pool size in Spring StateMachine 3.0.1

We upgraded from Spring Statemachine 2.5.0 to Spring StateMachine 3.0.1 in our project. Our application run a series of processes, each process runs through its business logic within its own state machine. When we were using State Machine 2.5.0,…
Matt Brown
  • 435
  • 4
  • 17
2
votes
2 answers

How to get the current substate and the parent state out of the Spring Statemachine?

I am running a hierachical Spring Statemachine and - after walking through the inital transitions into state UP with the default substate STOPPED - want to use statemachine.getState(). Trouble is, it gives me only the parent state UP, and I cannot…
onouv
  • 528
  • 1
  • 5
  • 12
2
votes
1 answer

Spring State Machine Sometimes Spams Retry Exhausted Error

I have setup what I think is a relatively simple Spring State Machine. Sometimes (maybe every time) something triggers an external event, I get a ton of these errors. Any idea what I am doing wrong? I get the following error about 10 times in a row…
cstack
  • 395
  • 1
  • 15
2
votes
1 answer

How to check if the event triggers the state machine in Spring Statemachine?

Let me summarize my question as follows, I know that the stateMachine.sendEvent(Event e) returns a boolean value representing if the event triggers a transition or not, but it also triggers the transition if true. However, I want only to check if…
batuhancan
  • 37
  • 5
2
votes
1 answer

Can I use timerOnce with StateMachineRuntimePersister?

I have a spring statemachine (version 3.0.1) with an own instance for each user. With every HTTP request the statemachine is acquired by a DefaultStateMachineService from a JpaStateMachineRepository. At the end of the HTTP request the statemachine…
tangens
  • 39,095
  • 19
  • 120
  • 139
2
votes
0 answers

Spring State Machine Modelling Tool Support in Intellij

I have just migrated from Eclipse to Intellij [we can use this only now]. We are having lot of Spring State Machine Model Diagrams (https://spring.io/projects/spring-statemachine) created via Papyrus Plugin (https://www.eclipse.org/papyrus/) in…
Shirsh Sinha
  • 156
  • 2
  • 8
2
votes
0 answers

Unable to inject Spring State machine within test context (No qualifying bean of type JpaStateMachineRepository)

I'm writing a test case to inject an instance of my Spring State Machine and input some events but nothing so far has made it start the context properly State Machine Config @Configuration @EnableStateMachineFactory(contextEvents = false) …
2
votes
1 answer

Recommended approach when restoring a Spring State Machine instance

I am planning to use Spring State Machine to control an execution workflow. The system is expected to receive requests from multiple users and each user may be assigned to multiple workflows. My initial idea was to have one instance of SM per…
2
votes
0 answers

Why is Spring State Machine PersistStateChangeListener component sometimes not executing during same thread?

Long story short: We have a Spring State Machine implementation that will persist with a different request (on same thread from thread pool), causing a state error within our code. Why does it not run synchronously as part of same request? Much…
Brandon
  • 404
  • 6
  • 21
1 2
3
18 19