Camunda PoC - Queries and Clarifications

Hi,

We are close to completing a proof of concept (PoC) on Camunda wherein we are not using the Camunda out of box applications (Task list, Cockpit etc.) instead we have built a custom application in JSP. We are making REST API calls from our custom application to the Camunda process engine to initiate the workflow, maintain and update process variables, claim tasks, get pending tasks, complete tasks, get history related data, etc.

During the course of doing the PoC, the following queries have come up

Distributed Commit - We wanted to ascertain if there are any best practices that can be followed while making a Distributed Commit to manage distributed atomic transactions at places where we need to update our Custom Application database as well as use REST API calls to update the Camunda Application database. Are there any best practices that can be followed for the same?

Exception Management - Consider a scenario in which some exception occurs at Runtime during the execution of the Process definition. Will the Camunda process engine handle such a situation by rolling back the transaction to the previous User task with all the updated process variables rolled back to the older revision OR Should such scenarios be managed at the Custom Application level where we catch such an exception and rollback the transaction to an older revision using REST API calls? We certainly can roll back the process variables to an older revision but can we rollback the process instance execution to a previous task using REST API calls?

User Information Management - In our POC, there are two databases, one is the Custom Application database and the other is the Camunda database. As per our understanding, both these databases need to have the same list of users which leads to a situation of duplication wherein whenever we create users in our Custom Application, the same user should also get created in the Camunda database. Is this the right way to carry out things and, if so, should we use REST API calls to synchronize the users in the application with the users in Camunda or is there any other approach that needs to be followed?

Business Rules - Currently, for implementing a business rule, we are using DMN with a single input process variable (region) to re-route a document to a region-specific group. Currently, we update a process variable in the Camunda application by making a REST API call from the Custom Application and, based on that process variable, business rule decisions are made by DMN. We wanted to check if, instead of using process variable sent by the Custom Application, is it possible to pull the updated value of the process variable from the Application database when required? Additionally, we also wanted to understand about the complexity of the business rules that can be handled via DMN?

Process Definition Versioning - There may be situations in which we would need to update the Process definition as per some new use cases and we may require the running process instances to continue their execution in the latest version instead the version they were initially started in. Basis the documentation, we understand that Camunda does possess such a capability but to a limited extent. We wanted to understand about the level of changes that may be required to migrate the running process instances to the latest version as well as what are the associated limitations?

Reporting - In our project, we have the need the support of reporting especially from the perspective of obtaining the history on the process instances. For this, should the Custom Application directly access and query the Camunda database OR should REST API calls be made to fetch the historical data? In these reports, we may also require duration details for the entire process instance execution excluding some tasks that might be irrelevant from an execution standpoint. How can this be achieved?

SLA’s & Prioritization - We may also require the capability of determining due dates for completion of a process instances wherein if any process instance is close to expiration then in our Custom Application, we need to bump up the Priority of the document corresponding to that process instance to Urgent. We understand that Priority and Due date can be mentioned for User tasks but can they also be leveraged for Process instances as well?

Kindly share your suggestions for the above mentioned queries.

Thanks in advance.

1 Like

Any suggestions for the above queries?

Hi @AakankshaTej,

regarding your questions:

a) Distributed Commit: You can register your own transaction manager for the process engine. Or you can use XA transactions. But in many cases, it’s better to use compensation instead of big transactions over multiple systems.

b) Exception Management: The process engine works with transactions. If an error occurs then the whole transaction is rolled back. See the User Guide.

c) User Information Management: It depends on your use case. You can also provide your own identity provider to connect the process engine to the other user database. Or the other way around, use the process engine’s identity service from the other application.

d) Business Rules: You can also model a process which fetches the value before evaluating the DMN decision. Please have a look at the reference guide to see what you can do with DMN in Camunda.

e) Process Definition Versioning: As described in the user guide, a running process instance stay on the version for which it is created. A new process instance starts on the latest version by default.

f) Reporting: You should query the history service or implement your own history back end.

g) SLA’s & Prioritization: You can build a process for this function in your application.

Best regards,
Philipp

1 Like

Hi,

Thank you for your response.
I am sorry but could you please provide an insight to the above mentioned point in Distributed Commit section - “it’s better to use compensation instead of big transactions over multiple systems.”
Are you referring to Compensating transactions?

Regards,
Aakanksha

Yes, it’s a kind of it. You can use compensation events or a transaction sub-process to model the “business transaction”. If one step fails then the process engine invokes the compensation handlers of the executed steps to undo the work.
Please have a look at the reference guide.

Best regards,
Philipp

Ok. Thanks for the clarification.

Regards,
Aakanksha

Hi Philipp,

After looking at the documentation, it appears that Camunda Compensation events can be useful for cases of Exception Management where may be an exception occurs and rollback is required and a Compensation trigger is fired to perform operations in a reverse order.
Our Use Case requires us to update different databases and hence our concern about Distributed Commit Solution for situations where either all the transactions in different databases from our Custom application will commit or all will be rolled back. I do understand the benefits of a Compensation model here but as we are using a Custom Application to update our Application database and calling the Camunda process engine using Rest API to invoke Workflow based transactions hence I wanted to understand how should we utilize the Compensation events in such a scenario.

For Example: Let us assume that there are 2 transactions which have to be executed.

  1. Update Custom Application database table
  2. Update Camunda process variables

Scenario 1: Transaction 1 fails and Transaction 2 has executed successfully.
Question1: Can we explicitly make a call to the Compensation trigger in the BPMN diagram?

Scenario 2: If Transaction 2 fails and Transaction 1 executes successfully
Probable solutions:
1- Auto-rollback as per Camunda functionality
2- Compensation handler gets called
Question 2: What is the difference between the above 2 solutions and what are the different cases that these can be applied for ?

Regards,
Aakanksha

1 Like

Hi AakankshaTej,

How did you manage this?