cancel
Showing results for 
Search instead for 
Did you mean: 

Can two Process Engines run from the same database?

marcthomas2012
Champ in-the-making
Champ in-the-making
Hi,

I was planning to have to process engines created using the code extract below, which share the same database and configuration file. Is this possible or will things go horribly wrong?

ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml")
                           .setProcessEngineName(engineName)
                           .buildProcessEngine();

Thanks
Marc
8 REPLIES 8

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
Yes, this is possible

marcthomas2012
Champ in-the-making
Champ in-the-making
I have just got to the point of trying this and I partly thought that because the process engine had a different name that it would behave independently of the other process engine, even if they were using the same database. This turns out to be an incorrect assumption. In hindsight I think this is fair enough.

I'll just have to work a slightly different way.

Thanks
Marc

jbarrez
Star Contributor
Star Contributor
What are you trying to accomplish by running two engines on the same database?
Note that this is not an uncommon thing: in a clustered environment this will always happen.

marcthomas2012
Champ in-the-making
Champ in-the-making
I am currently re-writing our workflow in our product to use a new engine that supports workflows generated by implementation managers. The current workflow engine has a whole pile of code that essentially duplicates the state machine that Activiti is handling.

I wanted to run a separate Activiti engine such that I can completely separate the old and new workflow code to make the legacy code removal at the end of this process much easier.

So, basically to make the engines completely separate, I will need to use a different configuration file that starts the Activiti engine in a different database?

Marc

jbarrez
Star Contributor
Star Contributor
No, you can have two activiti engines, with two different configuration files that go to the same database.

I don't see any issues with the approach you mention: keep running the old stuff with the old workflow, and use the activiti engine for the new stuff. That's exactly how we handle jbpm -> activiti migration in Alfresco.

marcthomas2012
Champ in-the-making
Champ in-the-making
The issue I found with the current way I was launching both engines, was that when each engine would ask Activiti which tasks does user with ID "1" have it would return the same task list for both engines. I'm assuming this is because the database is the same and therefore user with ID "1" will always return the tasks started by the old engine and the new engine.

Are you saying that it should be possible to use the same database and have two engines such that the old engine will only return activiti tasks for user "1" that were created in the old engine and the new engine could get the tasks created by the new engine, despite the user id being exactly the same?

Marc

jbarrez
Star Contributor
Star Contributor
The issue I found with the current way I was launching both engines, was that when each engine would ask Activiti which tasks does user with ID "1" have it would return the same task list for both engines. I'm assuming this is because the database is the same and therefore user with ID "1" will always return the tasks started by the old engine and the new engine.

I think that's pretty logical … it's the same data after all Smiley Tongue


Are you saying that it should be possible to use the same database and have two engines such that the old engine will only return activiti tasks for user "1" that were created in the old engine and the new engine could get the tasks created by the new engine, despite the user id being exactly the same?

I don't quite follow. You want one engine to see 'some' data and the other one the 'other' data? That's not feasible with a lot of customization from your side.
You could run on different database schema's, but then you don't have 'shared data', which I understand from your comment.

marcthomas2012
Champ in-the-making
Champ in-the-making
Okay, thanks. I understand now.

Marc