public ReceiveTaskBuilder builder() { return new ReceiveTaskBuilder((BpmnModelInstance) modelInstance, this); }
protected BpmnModelInstance createProcessWithReceiveTask(String key) { return Bpmn.createExecutableProcess(key) .startEvent() .receiveTask() .endEvent() .done(); }
.subProcess("SubProcess_1").embeddedSubProcess() .startEvent() .receiveTask("MessageReceiver_1").message(TEST_MESSAGE_NAME) .camundaInputParameter("localVar", "${loopVar}") .camundaInputParameter("constVar", "someValue") //to test array of parameters .userTask("UserTask_1") .endEvent() .subProcessDone()
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 testCompositeExpressionForInputValue() { // given BpmnModelInstance instance = Bpmn.createExecutableProcess("Process") .startEvent() .receiveTask() .camundaInputParameter("var", "Hello World${'!'}") .endEvent("end") .done(); deployment(instance); runtimeService.startProcessInstanceByKey("Process"); // when VariableInstance variableInstance = runtimeService .createVariableInstanceQuery() .variableName("var") .singleResult(); // then assertEquals("Hello World!", variableInstance.getValue()); }
@Test public void testCompletingSuspendedJobDuringRunningInstance() { testRule.deploy(Bpmn.createExecutableProcess("process") .startEvent() .receiveTask() .intermediateCatchEvent() .timerWithDuration("PT0M") .endEvent() .done()); // given // a process definition ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult(); // a running instance ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinition.getId()); // suspend the process definition (and the job definitions) repositoryService.suspendProcessDefinitionById(processDefinition.getId()); // assert that there still exists a running and active process instance assertEquals(1, runtimeService.createProcessInstanceQuery().active().count()); // when runtimeService.signal(processInstance.getId()); // then // there should be one suspended job assertEquals(1, managementService.createJobQuery().suspended().count()); assertEquals(0, managementService.createJobQuery().active().count()); assertEquals(1, runtimeService.createProcessInstanceQuery().active().count()); }
.subProcess("SubProcess_1").embeddedSubProcess() .startEvent() .receiveTask("MessageReceiver_1").message(TEST_MESSAGE_NAME) .camundaInputParameter("localVar", "${loopVar}") .camundaInputParameter("constVar", "someValue") //to test array of parameters .userTask("UserTask_1") .endEvent() .subProcessDone()
public void testCompositeExpressionForInputValue() { // given BpmnModelInstance instance = Bpmn.createExecutableProcess("Process") .startEvent() .receiveTask() .camundaInputParameter("var", "Hello World${'!'}") .endEvent("end") .done(); deployment(instance); runtimeService.startProcessInstanceByKey("Process"); // when VariableInstance variableInstance = runtimeService .createVariableInstanceQuery() .variableName("var") .singleResult(); // then assertEquals("Hello World!", variableInstance.getValue()); }
@Test public void testCompletingSuspendedJobDuringRunningInstance() { testRule.deploy(Bpmn.createExecutableProcess("process") .startEvent() .receiveTask() .intermediateCatchEvent() .timerWithDuration("PT0M") .endEvent() .done()); // given // a process definition ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult(); // a running instance ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinition.getId()); // suspend the process definition (and the job definitions) repositoryService.suspendProcessDefinitionById(processDefinition.getId()); // assert that there still exists a running and active process instance assertEquals(1, runtimeService.createProcessInstanceQuery().active().count()); // when runtimeService.signal(processInstance.getId()); // then // there should be one suspended job assertEquals(1, managementService.createJobQuery().suspended().count()); assertEquals(0, managementService.createJobQuery().active().count()); assertEquals(1, runtimeService.createProcessInstanceQuery().active().count()); }
.subProcess("SubProcess_1").embeddedSubProcess() .startEvent() .receiveTask("MessageReceiver_1").message(TEST_MESSAGE_NAME) .camundaInputParameter("localVar", "${loopVar}") .camundaInputParameter("constVar", "someValue") //to test array of parameters .userTask("UserTask_1") .endEvent() .subProcessDone()
public ReceiveTaskBuilder builder() { return new ReceiveTaskBuilder((BpmnModelInstance) modelInstance, this); }
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); }
.subProcess("SubProcess_1").embeddedSubProcess() .startEvent() .receiveTask("MessageReceiver_1").message(TEST_MESSAGE_NAME) .camundaInputParameter("localVar", "${loopVar}") .camundaInputParameter("constVar", "someValue") //to test array of parameters .userTask("UserTask_1") .endEvent() .subProcessDone()
public ReceiveTaskBuilder builder() { return new ReceiveTaskBuilder((BpmnModelInstance) modelInstance, this); }
protected BpmnModelInstance createProcessWithReceiveTask(String key) { return Bpmn.createExecutableProcess(key) .startEvent() .receiveTask() .endEvent() .done(); }
.subProcess("SubProcess_1").embeddedSubProcess() .startEvent() .receiveTask("MessageReceiver_1").message(TEST_MESSAGE_NAME) .camundaInputParameter("localVar", "${loopVar}") .camundaInputParameter("constVar", "someValue") //to test array of parameters .userTask("UserTask_1") .endEvent() .subProcessDone()
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); }
.subProcess("SubProcess_1").embeddedSubProcess() .startEvent() .receiveTask("MessageReceiver_1").message(TEST_MESSAGE_NAME) .camundaInputParameter("localVar", "${loopVar}") .camundaInputParameter("constVar", "someValue") //to test array of parameters .userTask("UserTask_1") .endEvent() .subProcessDone()