1

My workflow is quite simple, I have two script, first script is ASYNC and the second is SYNC. In each script I have a loop from 0 to Integer.MAX_VALUE as follow

for(int i=0;i<Integer.MAX_VALUE;i++)
   System.out.println("value is "+i);

When I run my process, it starts working and I can see in my log file that it is being filled. But when I want to stop it, I find nothing in my active process instances, neither in completed process or even in aborted. even if I check my data base, I have nothing related to this process in the ProcessInstanceInfo or even ProcessInstanceLog. So weird isn't it? what could be the reason?

The goal from creating this workflow is to see the difference between ASYNC and SYNC tasks, because as I know that ASYNC tasks when they start running, the workflow don't have to wait until this task finish, but what I have is that my task ASYNC is still running and it didn't go to next task. So my second question is can any one give me the difference between ASYNC and SYNC with a good example to learn. I would appreciate if I'll get at least one answer on one of my two questions. thanks

Bashir
  • 2,057
  • 5
  • 19
  • 44

1 Answers1

0

What do you stop? Do you abort the process instance ?

In the scripts you can populate the process variables with kcontext.setVariable("variable_name","variable_value"). This will reflect in DB if you have defined the process variable persistent in the process model.

The tasks, the sync one will return the flow control to the process when is completed. In contrast to the async one, process flow will continue immediately after it sends the async tasks to execute.

Bashir
  • 2,057
  • 5
  • 19
  • 44
zhrist
  • 1,169
  • 11
  • 28
  • the problem is that the process Instance id is not persisted into the table if the first task is a script task, I think it's a bug in Jbpm, you didn't understand the question once again – Bashir Jul 10 '20 at 08:18
  • That is true. Until you are in the script, it will not. That is because before that there was only a start signal. I think if the process instance is on signal and escript, the process instance is still in memory, and on the first node, it will save the state in the table. If the process is active, you will have a record in processinstanceinfo table. But I have processes waitng on the first signal after the start and those are saved in table record alredy. – zhrist Jul 12 '20 at 10:58