Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View tijsrademakers's full-sized avatar

Tijs Rademakers tijsrademakers

  • KIS Consultancy
  • Eindhoven
View GitHub Profile
@Test
public testIntroProcess() {
....
HistoricVariableInstance historicVariable = historyService.createHistoricVariableInstanceQuery()
.processInstanceId(processInstance.getId())
.singleResult();
assertEquals("variablePresent", historicVariable.getVariableName());
assertEquals(false, historicVariable.getValue());
processInstance = runtimeService.startProcessInstanceByKey("intro", Collections.singletonMap("intro", (Object) "a test intro value"));
public class IntroTask implements JavaDelegate {
public void execute(DelegateExecution execution) {
if (execution.hasVariable("intro")) {
System.out.println("Intro variable available with value " + execution.getVariable("intro"));
execution.setVariable("variablePresent", true);
} else {
System.out.println("Intro variable not available");
execution.setVariable("variablePresent", false);
}
@Test
public void testIntroProcess() {
// Create Flowable engine
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// Get main service interfaces
RepositoryService repositoryService = processEngine.getRepositoryService();
RuntimeService runtimeService = processEngine.getRuntimeService();
HistoryService historyService = processEngine.getHistoryService();
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="introExample"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:flowable="http://flowable.org/bpmn"
targetNamespace="http://flowable.org/examples">
<process id="intro">
<startEvent id="start"/>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<name>Flowable Intro</name>
<groupId>org.flowable.examples</groupId>
<artifactId>flowable-intro</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="processEngineConfiguration"
class="org.flowable.engine.impl.cfg.StandaloneProcessEngineConfiguration">
<property name="jdbcUrl" value="jdbc:h2:mem:flowable;DB_CLOSE_DELAY=1000;MVCC=TRUE" />
<property name="jdbcDriver" value="org.h2.Driver" />
<property name="jdbcUsername" value="sa" />
public class AsyncCamelRoute extends RouteBuilder {
@Override
public void configure() throws Exception {
from("activiti:camelProces:camelTask").to("seda:asyncQueue");
from("seda:asyncQueue").to("bean:heavyDutyBean").to("seda:receiveQueue"); // do some integration logic here
from("seda:receiveQueue").to("activiti:camelProcess:receiveTask");
}
}
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI"
typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath"
targetNamespace="http://www.activiti.org/test">
<process id="camelProcess">
<startEvent id="start" />
<sequenceFlow id="flow1" sourceRef="start" targetRef="camelTask" />
<serviceTask id="camelTask" name="Invoke Camel route" activiti:type="camel" />
<camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring">
<packageScan>
<package>org.activiti.camel.route</package>
</packageScan>
</camelContext>
<serviceTask id="serviceTask2" activiti:type="camel">
<extensionElements>
<activiti:field name="camelContext" stringValue="customCamelContext" />
</extensionElements>
</serviceTask>