Initialising a database schema upon process application deployment

Hello,

is there a way to initialize a database schema and tables upon the deployment of a process application?

The use case is a task listener for every user task, that writes information from the task into a seperate table in a different schema, but in the same database as camunda. For that, the schema and tables must already be created. At the moment the task listener checks if the schema is already existing, and if it’s not it is creating it. But a more centralized solution seems better, because every user task gets a task listener through a parse listener and tries to create the schema/tables.

EDIT: I am NOT using Spring Boot, I’m using the pre-packaged distribution for wildfly 11

Any ideas would be appreciated

Hi @dirkw65,

you could try using a ProcessEnginePlugin for this. Check out the documentation to learn more about them. The basic idea is to hook into the engine creation process to apply some modifications. I think you could create your schema there.

1 Like

Hi @dirkw65,

if I understand you correctly you are already deploying a process application, so you might also make use of the available hooks they offer, depending on the type of application you are building.

Please consult the documentation for more details:
https://docs.camunda.org/manual/latest/user-guide/process-applications/the-process-application-class/

Best,
Tobias

2 Likes

@Miklas @tmetzke Thank you guys, I was able to get it working :slight_smile:

Hey @dirkw65,

glad to hear!

Could you maybe quickly outline how your solution looks like now, so others can find some inspiration when they are looking here?
I am sure that would be of great help to others!

Best,
Tobias

My solution:

instead of creating the needed schema and tables upon the deployment of a process application or in every task listener directly I opted to do it in the ProcessEngineConfiguration.

Since I needed to create a custom ProcessEngineConfiguration to add a parse listener anyway, this was a convenient place to perform these actions. This means this very much correlates to @Miklas suggested engine plugin solution.

1 Like