Camunda Team Blog

Camunda BPM 7.3.0-alpha2 released

Written by Daniel Meyer on , under Execution category.
A new alpha release of our open source BPM and Workflow platform is available for download. The highlights of this release are:
  • Process Engine and Rest Api
    • Native JSON and XML Variable Value Types
    • Improved Sorting: specify multiple sort parameters in rest api, sort task by variable value
    • Historic Job Log
    • Support for databases: Oracle 12c
    • Partially Order Historic Activity Instances by occurrence
  • Cockpit
    • UI improvements
    • Advanced Process Instance Search (enterprise feature)
  • Tasklist
    • Sort by multiple parameters
    • Sort by variable value
  • Admin
    • Browse Users by Group
  • JavaScript SDK
    • Add group resource
    • Support local variables
The full release notes can retrieved from Jira. The known issues as well.


Run this Release with Docker

If you want to run this release with Docker, you can use the freshly baked Docker images. The following command line will start the tomcat distribution:
docker pull camunda/camunda-bpm-platform:7.3.0-alpha2
docker run -d --name camunda -p 8080:8080 camunda/camunda-bpm-platform:7.3.0-alpha2
Open browser with url: http://localhost:8080/camunda/

See the Camunda Docker Images project for alternative distributions and versions.

Native XML and JSON Variable Types

This feature allows you to work with Xml and Json variables in a "native" way, in both the Rest Api and the Java Api.

Assume you have the following Json Document:
{
  "customerId": "SFAS-342434",
  "revenue": 3324.43,
  ...
}
Then it can be stored as Json variable in the following way:
import static org.camunda.spin.plugin.variable.SpinValues.*;

// assuming the json document is available as string variable
String customerData = ...;

// set the customer as json variable of a process instance
runtimeService.setVariable(pid, "customerData", jsonValue(customerData));
The important part is the jsonValue(...) method. It tells the process engine that the provided string should not be interpreted as a string but as a json value. What is the benefit?

First, the value can be of arbitrary size (while the max character size for string values is limited).

If we request the variable in expression language (when implementing the condition of a sequence flow), we can directly access the properties of the json object:
<sequenceFlow name="vip customer" sourceRef="..." targetRef="...">
  <conditionExpression xsi:type="tFormalExpression">
    <![CDATA[
      ${ customerData.prop("revenue").doubleValue() >= 10000 }
    ]]>
  </conditionExpression>
</sequenceFlow>
Note how we can directly access a property of the json object in customer.prop("revenue").

How is this possible? The process engine internally uses the Camunda Spin library for parsing the Json value with Jackson and providing a lightweight wrapper over the Jackson Api, optimized for fluent Api access.

You get the same benefit if you request the variable from java code:
public class ProcessCustomerData implements JavaDelegate {

  public void execute(DelegateExecution execution) {
    JsonValue customerData = execution.getVariableTyped("customerData");
    
    double revenue = customerData.getValue().prop("revenue").doubleValue();
  }

}
Note that if the same variable is requested multiple times in the same command, it will only be parsed once.

In case you do not need a parsed representation, you can also request the serialized (string) representation:
JsonValue customerData = execution.getVariableTyped("customerData", false);    
String valueAsString = customerData.getValueSerialized();
For this feature some documentation is still missing but you can already read Roman's Blogpost and checkout the example on GitHub.

Sort Tasks by Variable Value

When querying for tasks, it is now possible to sort by variable value:
taskService.createTaskQuery()
  .taskAssignee("jonny")
  .orderByDueDate().desc()
  .orderByTaskVariable("invoiceAmount", ValueType.DOUBLE).desc()
  .list();

The same can be done in the Tasklist as you can see here:



Advanced Process Instance Search

We added an enterprise feature to Cockpit which allows searching for process instances with complex criteria:

The most awesome things are yet to come!

We have amazing things in the pipepline. On current master it is already possible to do this:
List executions = runtimeService.createExecutionQuery()
  .processDefinitionKey("invoice")
  .activityId("selectAssignee")
  .list();

for (Execution e : executions) {
  runtimeService.createProcessInstanceModification(e.getProcessInstanceId())
    .cancelAllInActivity("selectApprover")
    .startBeforeActivity("approveInvoice")
      .setVariable("approver", "jonny1")
    .execute();
}
And that is just the beginning... :=)