public void testOutputParameterAvailableAfterParallelGateway() { // given BpmnModelInstance processDefinition = Bpmn.createExecutableProcess("process") .startEvent() .serviceTask() .camundaOutputParameter("variable", "A") .camundaExpression("${'this value does not matter'}") .parallelGateway("fork") .endEvent() .moveToNode("fork") .serviceTask().camundaExpression("${variable}") .receiveTask() .endEvent() .done(); // when deployment(processDefinition); runtimeService.startProcessInstanceByKey("process"); // then VariableInstance variableInstance = runtimeService .createVariableInstanceQuery() .variableName("variable") .singleResult(); assertNotNull(variableInstance); }
public static void main(String[] args) { BpmnModelInstance model = Bpmn.createExecutableProcess("payment") .startEvent() .serviceTask().id("charge").name("Charge credit card").camundaClass(ChargeCreditCardAdapter.class.getName()) // .boundaryEvent().error() .serviceTask().name("Ask customer to update credit card").camundaExpression("#{true}") // noop .receiveTask().id("wait").name("Wait for new credit card data").message("CreditCardUpdated") .boundaryEvent().timerWithDuration("PT7D") // 7 days .endEvent().camundaExecutionListenerClass("end", PaymentFailedAdapter.class.getName()) .moveToActivity("wait").connectTo("charge") // loop back with new data .moveToActivity("charge") .endEvent().camundaExecutionListenerClass("end", PaymentCompletedAdapter.class.getName()) .done(); File file = new File("result.bpmn"); Bpmn.writeModelToFile(file, model); } }
public void testOutputParameterAvailableAfterParallelGateway() { // given BpmnModelInstance processDefinition = Bpmn.createExecutableProcess("process") .startEvent() .serviceTask() .camundaOutputParameter("variable", "A") .camundaExpression("${'this value does not matter'}") .parallelGateway("fork") .endEvent() .moveToNode("fork") .serviceTask().camundaExpression("${variable}") .receiveTask() .endEvent() .done(); // when deployment(processDefinition); runtimeService.startProcessInstanceByKey("process"); // then VariableInstance variableInstance = runtimeService .createVariableInstanceQuery() .variableName("variable") .singleResult(); assertNotNull(variableInstance); }