spring-projects / spring-statemachine

Spring Statemachine is a framework for application developers to use state machine concepts with Spring.
1.51k stars 598 forks source link

Firing event from State Entry Action #1107

Open rishikesh13 opened 1 year ago

rishikesh13 commented 1 year ago

We need to build state machine with following configuration

If state machine reaches stage S1, we need to run action which makes API call to third party service. Based on response of API call, state machine should either move to S2 or S3. To achieve this, we are planning to configure state entry action on S1 which will make API call and based on response send event E2/E3 to state machine to make movement to S2/S3. Is there downside/side effect of firing event from state entry action to achieve this?

We tried with state action but found out it schedules state action on thread pool which we don't want and therefore using state entry action to make sure action runs in callers thread.