Hi guys,
I need to catch the Variable creation in order to add my business logic. Is this possible?
Thanks
Hi guys,
I need to catch the Variable creation in order to add my business logic. Is this possible?
Thanks
Hi @lsantaniello,
there is no API to get informed when a variable is created. Can you please tell more about your use case?
Best regards,
Philipp
Hi @Philipp_Ossler, I need to extend the Camunda Features. I can’t to work on specific use case (or specific BPMN). I need to integrate a custom logic with Process Variables has been created or updated.
Thanks
Luca
Hi Luca,
the easiest way is to wrap the variable creation into a custom class (i.e. create / update variables only using this custom class). If this is not possible then you may use a history event handler which receives all history variable events.
Beside that, you can try to hook into the internal classes. An entry point may be ExecutionEntity which allows to register variable listeners.
For CMMN, it’s possible to register variable listeners. Feel free to work on a proper solution for BPMN.
Best regards,
Philipp
Thanks @Philipp_Ossler, I’m using the Camunda Spring Boot and I would like to integrate a custom class in order to extends the CRUD operations of variables. Could you please give me an advice?
Thanks
Luca
Hi Luca,
a common solution is to use a business class which wraps the variable access. For example:
class BusinessContext {
void wrap(DelegateExecution execution) { ... }
String getCustomerId() {
return (String) execution.getVariable("customer-id")
}
void setCustomerId(String customerId) { ... }
}
class MyDelegate implements JavaDelegate {
public void execute(DelegateExecution execution) {
businessContext.wrap(execution);
String customerId = businessContext.getCustomerId();
// ...
}
}
Does this help you?
Best regards,
Philipp