cancel
Showing results for 
Search instead for 
Did you mean: 

Multi server environment

einszwo
Champ in-the-making
Champ in-the-making
Hi everyone,

I have a question about using activiti in an environment where my application is deployed redundant on more than one server to ensure availability for the users.
All applications pointing on the same database ( So only one db exists).
My embedded process engine of course is part of the application so it is also deployed on more than one server.

I want to know how activiti is able to handle this.
For example if a message is caught which starts my business process on server A, but the next task would be a user task which is claimed and completed on server B. I think this would not be a problem.
If the next task (Service Task) throws an exception on server B is Server A able to execute it again?
So I try to to define my question more precisely.
If a business process which only consists of service tasks is started on Server A can be finished on this server, because the server has any problem, is Server B able to finish it when pointing on the same db?
Of course I also hope that not both server will concurrently execute for example service task 1.

I integrated the process engine in an spring context. So I use springs transaction management. In my imagination, when an Exception occurs in one part of the business process, all data written to the db will be rolled back so the task is still not executed and an other server could execute it again. I hope this managed automatically by the process engine?

An other question is whats about atomic steps in activiti.
For example when my process models 10 service tasks which all must be executed without an error or everything must be rolled back.
Is this possible with activiti? Do I have to model the process to deal with it for example with boundary exception events on sub processes which should be atomic?

Best regards,

Markus
3 REPLIES 3

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Markus,

I want to know how activiti is able to handle this.
yes.

If the next task (Service Task) throws an exception on server B is Server A able to execute it again?
I assume that service task is asynchronous and jobexecutor is running on both instances A,B. (all code is available on A,B). then the answer is yes.

I hope this managed automatically by the process engine?
Yes, but you have to understand what is part of the transaction and what is not. (read doc)

Is this possible with activiti?
Yes. Read more bout wait states and transaction management in activiti source.

Regards
Martin

einszwo
Champ in-the-making
Champ in-the-making
Ok I read the documentation again and I think I understand the concepts.
Let me outline it:

I have an infrastructure with Server A and Server B with an embedded process engine pointing on the same database.

I have a simple process model (no parallel execution) with two Service Tasks (Service Task 1 and Service Task 2) which are configured with activiti:async="true" and activiti:exclusive="true".

I use the new Async executor.

When a process instance of the process model starts on server A, it is locked in DB and Service Task 1 ist executed. After execution the transaction ist committed an the process instance is unlocked.
In the next step maybe Server A or B tries to execute Service Task 2. Which one is not specified. For example it could be Server B which than locks the process instance again executes the task, commits the transaction and unlocks the process instance.  

Than the process instance is finished.

If an exception occurs when executing a Service Task, the process instance will be unlocked and the job will be retried after configured time? (by some Server??? Or by the same server??)

Do I unterstand it the concepts right?

jbarrez
Star Contributor
Star Contributor
Yes, that is correct.

The time to wait is set in the config file of the server, and indeed can be different from server to server (if you really would want that).