I am building on the tutorials taken from the Camunda website. I have completed the bpmn process tutorial with spring boot and also the dmn one.
Im looking to combine a bpmn with dmn. Have managed to get as far as decision table being triggered but when I pass the decusion table output into to DishReviewDelete process (last step in bpmn) im unsure how to access the decision dish variable. To word this another way. How do i get the decision output in JavaDelegate tasks?
I have the following BPMN There are 4 parts to it.
The review tasks are just points where I can log output or point debugger.
- Season → sets Season variable … .e.g Winter
- SeasonReview → view variables … i.e. sanity check that Season has been set. This works ok. logs and debugger have verified this
@Component
public class SeasonReviewDelegate implements JavaDelegate {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
public void execute(DelegateExecution execution) throws Exception {
String season = (String) execution.getVariable("season");
logger.info("season value is", season);
}
}
-
Decision table Same as - “simple decision table” found here What is DMN? DMN Tutorial and Examples | Camunda
-
Now this is the part im having trouble with. How do I get the output of the decision here?
@Component
public class DishReviewDelegate implements JavaDelegate {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
public void execute(DelegateExecution execution) throws Exception {
logger.info("reviewing output of dish decision");
logger.info("available keys:{}", execution.getVariables().keySet()); // only season is available here
String dish = (String) execution.getVariable("dish");
logger.info("dish is {} ", dish); // this is null
}
}
Output logs
2018-09-23 16:31:48.199 INFO 18604 --- [ main] org.camunda.bpm.container : ENGINE-08023 Deployment summary for process archive 'appCamundaDemo':
simple-dish.dmn
process-to-season-dmn.bpmn
2018-09-23 16:31:48.396 INFO 18604 --- [ main] org.camunda.bpm.application : ENGINE-07021 ProcessApplication 'appCamundaDemo' registered for DB deployments [c915aeb0-bf45-11e8-b589-024293c421b1]. Will execute process definitions
DishGenerator[version: 1, id: DishGenerator:1:c9236a53-bf45-11e8-b589-024293c421b1]
Deployment does not provide any case definitions.
2018-09-23 16:31:48.421 INFO 18604 --- [ main] demo.camunda.task.SeasonDelegate : executed set season Winter
2018-09-23 16:31:48.421 INFO 18604 --- [ main] demo.camunda.task.SeasonReviewDelegate : season value is Winter
2018-09-23 16:31:48.448 INFO 18604 --- [ main] demo.camunda.task.DishReviewDelegate : reviewing output of dish decision
2018-09-23 16:31:48.448 INFO 18604 --- [ main] demo.camunda.task.DishReviewDelegate : available keys:[season]
2018-09-23 16:31:48.448 INFO 18604 --- [ main] demo.camunda.task.DishReviewDelegate : dish is null
ive added demo to github here also
GitHub - davidsonr/demo-camuda: simple camunda demo with bpmn and dmn