State machine in Mendix?

1
Hi, I have an issue with a microflow which will run longer than 60 sec. and an asynchronous is no suitable solution. When I am switch to an asynchronous call, I will get the next issue with a java action. One idea is to solve the issue with a state machine and display the next state on the page and perform depending on the previous state the next iteration. But now I am struggling with the user feedback and the next iteration. I tried it with events, but the widget wasn’t refreshed during the run of the state machine. Do you have any ideas to solve this issue? Here some pictures from my example project without the initial problem. I am want to make sure, that the simple solution works. Before I will change the original microflow. Thanks, Ingo Event microflow State machine Starting the state machine   Front end 
asked
3 answers
4

What do you mean with "during the run"? A refresh only happens at the end of a microflow cascade. There is no refresh in between.

If you want to show changes while your microflow is running, you could run the state transition microflow in the background and build your page with a refresh interval (the template grid can do that). It's not really nice, I know. 

answered
0

Thanks for your answer. I am using three microflows to start the state machine, execute and realize the feedback/ next state to the state machine microflow.

What I am mean with run:

  • I am staring the state machine, by setting the next state parameter of the state machine object and call the state machine > With a return state machine object as return value
  • After state 1 and 2 a new state will be set. And the state machine object will be committed and creates an event
  • This event calls a further microflow which check the state and in case the finished state wasn’t set. The microflow calls the state machine again
  • Nothing was refreshed on the front end
  • I have added some log lines to get more details how the microflow will be executed

 

I can try your workaround to refresh the front-end data. But I am not sure if it fixes the issue, which I have with my real application. In this application I am put some data via rest api, starts an external calculation and get the result as well via rest api and show it on the frontend. This was implemented in a single microflow and processing time is between 90s and 120s. So, I will get a timeout for a synchronous call, an asynchronous will not work with the java activities in the microflow. Does the event handler will reset the timeout?

Log (debugging environment)


 

2020-02-17 10:33:15.494

start state machine

starting state machine


 

2020-02-17 10:33:25.495

state 1

finished


 

2020-02-17 10:33:25.497

state machine feedback

commit event


 

2020-02-17 10:33:35.500

state 2

finished


 

2020-02-17 10:33:35.502

state machine feedback

commit event


 

2020-02-17 10:33:35.504

state 3

finished


 

2020-02-17 10:33:35.505

state machine merge

'end event'


 

2020-02-17 10:33:35.523

state machine merge

'end event'


 

2020-02-17 10:33:35.524

state machine merge

'end event'

answered
0

Now it works :-)

 

answered