I would like to set variables globally, and all these variables are stateless.
For example, I would like to set URL’s globally only once for the entire spring boot camunda application.
Right now the below code executes for every single request, as below variables are stateless, I would like to set these variables only ONCE
Here is the sample code which we are using it now, but would like to refactor
ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
ProcessInstantiationBuilder instance = engine.getRuntimeService().createProcessInstanceByKey("create-template");
instance.setVariable("URL1","https://google.com");
instance.setVariable("URL2","https://forum.camunda.io");
ProcessInstanceWithVariables response = instance.executeWithVariablesInReturn();
refactored above code, which is not working how I expected, this where I would need help from community
I would like to set those variables on application start up
@Bean
public RuntimeService setGlobalVariablesForCamunda(){
ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
RuntimeService runtimeService = engine.getRuntimeService();
runtimeService.setVariable(Constants.KEY_WF_CRUD_API_BASE_URL,wfCrudApiBaseUrl, null);
runtimeService.setVariable(Constants.KEY_CREATE_WORKFLOW,createWorkflowUrl, null);
return runtimeService
}
Again I would like to set up these variables only once, as they are NOT going to changes for every bpmn file. Not sure to which class in camunda I need to setup these variables.
I would like to use these variables in process instance (in my bpmn files).
I have 20 bpmn files in my project, all these bpmn files would need these variables (URL1, URL2) and these are stateless variables, these are not going to change for across for every bpmn file.
All bpmn files are using these variables (URL1, URL2).
I would like to set these variables once and use it across different bpmn process
I tried using RuntimeService, but it did’nt work.
Any suggestion would be a great help
thanks,
Sharath