Diagram without bpmndi?

We are generating bpmn process xml in our application and want to deploy it to the Camunda 7.18 platform. Although we can generate the relationships between elements as expressed in the “bpmn” namespace, we have not generated the geometric information for the diagram as expressed in the “bpmndi” namespace.

This means our bpmn does not load in the modeler, and while we can deploy to the camunda platform and indeed run it, no diagram shows when we view a process instance in the cockpit. That makes it hard to debug because we can’t easily tell which task is current.

Is there some package or utility we can use to supply the missing diagram using some default layout rules?

I assume that people create business process definitions using other modelers, business process definitions that have been used in other servers that are not camunda so there must be a way to do this that is well understood and works.

Example file attached.

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions
 xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
 xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
 xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
 xmlns:camunda="http://camunda.org/schema/1.0/bpmn"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
 xmlns:modeler="http://camunda.org/schema/modeler/1.0"
 id="Definitions_1u0q0hw"
 targetNamespace="http://bpmn.io/schema/bpmn"
 exporter="Camunda Modeler"
 exporterVersion="5.7.0"
 modeler:executionPlatform="Camunda Platform"
 modeler:executionPlatformVersion="7.18.0"
 >
<bpmn:process id="email-not-opened" name="email-not-opened" isExecutable="true">
<bpmn:startEvent id="BEG">
  <bpmn:outgoing>FlowTo_Rule1</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="FlowTo_Rule1" sourceRef="BEG" targetRef="Rule1" />

<bpmn:serviceTask id="Rule1" name="email not opened" camunda:type="external" camunda:topic="IfEmailNotOpened">
  <bpmn:incoming>FlowTo_Rule1</bpmn:incoming>
  <bpmn:outgoing>FlowTo_GATE1</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="FlowTo_Gate1" sourceRef="Rule1" targetRef="Gate1" />

<bpmn:exclusiveGateway id="Gate1">
  <bpmn:incoming>FlowTo_Gate1</bpmn:incoming>
  <bpmn:outgoing>FlowTo_Task1</bpmn:outgoing>
  <bpmn:outgoing>SkipTo_Rule2</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="FlowTo_Task1" name="yes" sourceRef="Gate1" targetRef="Task1">
  <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${resp}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SkipTo_Rule2" name="no" sourceRef="Gate1" targetRef="Rule2">
  <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${not resp}</bpmn:conditionExpression>
</bpmn:sequenceFlow>


<bpmn:serviceTask id="Task1" name="send a text" camunda:type="external" camunda:topic="SendText">
  <bpmn:extensionElements>
    <camunda:inputOutput>
      <camunda:inputParameter name="sendTo">$primary</camunda:inputParameter>
      <camunda:inputParameter name="text">Please check your email</camunda:inputParameter>
    </camunda:inputOutput>
  </bpmn:extensionElements>
  <bpmn:incoming>FlowTo_Task1</bpmn:incoming>
  <bpmn:outgoing>FlowTo_Rule2</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="FlowTo_Rule2" sourceRef="Rule1" targetRef="Rule2"/>


<bpmn:intermediateCatchEvent id="Rule2" name="7.2 seconds">
  <bpmn:incoming>FlowTo_Rule2</bpmn:incoming>
  <bpmn:incoming>SkipTo_Rule2</bpmn:incoming>
  <bpmn:outgoing>FlowTo_Rule3</bpmn:outgoing>
  <bpmn:timerEventDefinition id="Timer_Rule2">
    <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT7.2S</bpmn:timeDuration>
  </bpmn:timerEventDefinition>
</bpmn:intermediateCatchEvent>
<bpmn:sequenceFlow id="FlowTo_Rule3" sourceRef="Rule2" targetRef="Rule3"/>


<bpmn:serviceTask id="Rule3" name="email not opened" camunda:type="external" camunda:topic="IfEmailNotOpened">
  <bpmn:incoming>FlowTo_Rule3</bpmn:incoming>
  <bpmn:outgoing>FlowTo_GATE3</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="FlowTo_Gate3" sourceRef="Rule3" targetRef="Gate3" />

<bpmn:exclusiveGateway id="Gate3">
  <bpmn:incoming>FlowTo_Gate3</bpmn:incoming>
  <bpmn:outgoing>FlowTo_Task3</bpmn:outgoing>
  <bpmn:outgoing>SkipTo_END</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="FlowTo_Task3" name="yes" sourceRef="Gate3" targetRef="Task3">
  <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${resp}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SkipTo_END" name="no" sourceRef="Gate3" targetRef="END">
  <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${not resp}</bpmn:conditionExpression>
</bpmn:sequenceFlow>


<bpmn:serviceTask id="Task3" name="send an email, to primary and their manager" camunda:type="external" camunda:topic="SendEmailMgr">
  <bpmn:extensionElements>
    <camunda:inputOutput>
      <camunda:inputParameter name="subject">Recent Email</camunda:inputParameter>
      <camunda:inputParameter name="text">I sent an email to $primary 3 days ago and he still hasn't opened it!</camunda:inputParameter>
    </camunda:inputOutput>
  </bpmn:extensionElements>
  <bpmn:incoming>FlowTo_Task3</bpmn:incoming>
  <bpmn:outgoing>FlowTo_END</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="FlowTo_END" sourceRef="Rule3" targetRef="END"/>

<bpmn:endEvent id="END">
  <bpmn:incoming>FlowTo_END</bpmn:incoming>
</bpmn:endEvent>
</bpmn:process>
</bpmn:definitions>

Hi @eSecure and welcome to the forum,

I don’t know of any program that is doing this by default.
However, Camunda’s BPMN Model API has a simple layout algorithm implemented. You can use this library to…

  1. Parse your current BPMN Model
  2. Recreate the model element by element. I would start with the start-event and use a breadth-first search or depth-first search.
  3. While the model is recreated, the libraries auto-layouting algorithm will be applied, and you’ll receive an equivalent BPMN Model with BPMNDI information.

I hope this helps!

Hi @StephanHaarmann Could you please provide an example,
I use the BPMN Model API to create bpmn.xml ,I encountered the same problem.I have checked the information that the flowable engine can use new BpmnAutoLayout (bpmnModel). execute(); Does camunda have a similar API or package.
thanks!

Hi @leikui,

as far as I know, Camunda’s BPMN library does not provide a method for auto-layouting. However, since BPMN is a standard, the result of the flowable call should be compatible with Camunda.

Okay, thank you