cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti with no forms and modelling machines as users

vrootid4
Champ in-the-making
Champ in-the-making
Hi,

Apologies for writing a long mail Smiley Happy.
We are in pursuit of building an enterprise application that utilizes the power of activiti. But there's a lot of dilema in our mind.
Here's what is currently available :
1. There are jobs that need to be scheduled. The jobs are executed on multiple web clients (say around 10+ machines). Each job with unique ID is added to just one machine (Say A) which is a starting point of the flow. The execution of each job has a sequence say A->B C-> B IF A AND C BOTH RECEIVED AT B THEN MOVE AHEAD SAY TO MACHINE D. The users are native to the APP and its like machine is responsible to decide the status of a job execution.
2. Our application is utilizing JSP, Struts2, Spring JDBC, MySQL (with app db and activiti db) and now activiti which we need to integrate.

What we want?
So as in (1) above once Machine A pulls the job 1 designated to it from its native DB it then Job 1 once completed at Machine A should continue the path as designed in the process diagram to other machines. BASICALLY we need a state machine / BPM and that is where we think activiti can help. But here's what is different

1. Form to add jobs to machines is already there.
2. Forms to display a job designated to it is also there.

3. How we think activiti can be integrated. Now as far as what we understand there are 2 ways to get this process instance started
a) 1st is a message start event which keeps polling the backend application database (not activiti db) to see whether there is a job to kick-off the process instance. Or this can be a none-start with a Java service task or Java receive task (real confusion here).
With this option most of our tasks will actually be polling the non-activiti db (app native db) to check for certain flags and move the sequence ahead.
b) An entirely different approach. Like a task can be claimed by a user in activiti can we model it in a way where actually a machine claims the whole task?
What approach is advisable?

Any help is appreciated.

Thanks.
14 REPLIES 14

frederikherema1
Star Contributor
Star Contributor
If you want to have parallel tasks, you should add another parralel-gateway, which "joins" all forked parallel paths. So you should have outgoing sequence-flows from the receive-tasks to one and the same gateway. When all parallel paths have been completed, the outgoing flow of that new "joining" gateway will be executed.

vrootid4
Champ in-the-making
Champ in-the-making
Appreciate the support Frederik.

We have modified the process based on your inputs. Attached the image with as .txt.
Please note that we have only the join gateways and no fork gateways. The tasks that Machine 1, 3, 5 … 15  receive are not same. The tasks are uniquely identified by say the machine hostID/hostname so each machine gets tasks designated for it. However we have the join gateways as suggested. Specifically for e.g. before process exec reaches 4 we check whether machine 2 and 3 had both completed their tasks. We just need activiti to govern the flow. The tasks that each machine must receive is pre-defined (with unique ids) and are independent in nature. One last review comments from you and I assure we will take it independently thereon. We thank you for all the support till date.

frederikherema1
Star Contributor
Star Contributor
The process you have now will make available receive-tasks machine 1, 3, … , 15 from the moment it starts. All these "machines" will execute the job. After machine 1 is completed AND machine 3 is completed, a receive-task for machine 4 is available. As soon as 4 is done and 5, 6 will become available. And it goes on in that order. So jobs 1, 3, …, 15 will be executed IN A RANDOM ORDER and jobs 2, 4, … will be executed in that order (with potentially an odd machine task in between).

Fine. Will put this to execution and test now.

Just one thing when you say All "machines" will execute the job. So it does not necessarily mean
that a copy of the "same" job is received by all "machines" right? So it could be for e.g. say considering an "Add User" usecase (task) and machine 1 is add User with ID 1 and machine 3 is adding a "different" User with ID3?

jbarrez
Star Contributor
Star Contributor
No, all machines can take the job, but only one can take it