Help migrating a few features from Activiti to Camunda

Hi,

Just finished initial work to replace Activiti with Camunda, but got stuck in a few places, and was looking for some help.

  1. Our application uses an embedded ProcessEngine. We have a custom web app written in Vaadin. In Activiti, an image of a running process could be generated as a PNG very easily. I understand bpmn-js is now the only method of rendering? Is https://github.com/bpmn-io/bpmn-js-examples a good place to start understanding how to do rendering?

  2. I would like to embed the entire Cockpit application, but can not find any references as to how it interacts with Camunda. Is it through the REST API?

  3. For testing, ActivitiEventListener (docs) would notify tests when a workflow had completed. Is there an equivalent feature in Camunda?

Thanks for the help! Excited to see the energy around Camunda, Activiti seemed to be getting stale, and the migration was relatively painless, except for these last two points.

Cheers,
-dan

1 Like

Hi Dan,

Great to hear that you are making the step from Activiti to Camunda :slight_smile:

  1. Your understanding is correct. The examples you found are good starting point. You can ask bpmn-js questions here: https://forum.bpmn.io/
  2. Cockpit is a Java web application including frontend and backend components. In short, it embeds the REST API but also includes custom REST endpoints and database queries. To gain a deeper understanding, you are probably best off to study sources available here: https://github.com/camunda/camunda-bpm-webapp
  3. I think there is no feature that does the exact same thing, but there may be a feature that solves the same problem. Could you please elaborate on the use case here, for example by outlining how the test would make use of such a listener?

Cheers,
Thorben

@thorben, thanks for the help, should be able to tackle #1 and #2 now.

The integration testing involves multiple asynchronous systems. ActivitiEventListener is used by the test to know when workflows are completed. The tests then start workflows that sometimes start children workflows, etc. When the correct events are caught, the test checks the results. Has been a handy feature for our somewhat unique application of Activiti/Camunda.

I found camunda-bpm-reactor last night, and it seems very similar, especially the bpmn-execution-listener. Couldn’t quite get it to work, but it feels like I’m on the right track. Will continue to ask questions if/when I get stuck.

EDIT: Browsing another question took me to the JUnit testing page, where I saw this code:

    Task task = taskService.createTaskQuery().singleResult();
    assertEquals("My Task", task.getName());

    taskService.complete(task.getId());

The taskService.complete(task.getId()) is exactly the pattern that we want to use, and had to implement in Activiti as a hack. I think we will start down this path…

Best,
-dan

I’m not sure why you need to do rendering of the diagrams. You can get the rendered PNG file via the REST API. See this documentation: https://docs.camunda.org/manual/7.7/reference/rest/process-definition/get-diagram/

The cockpit application can be found on Github as a standalone application. There is documentation on how to create a cockpit plugin here: https://docs.camunda.org/manual/7.7/examples/tutorials/develop-cockpit-plugin/

What do you mean by “notify tests”? Notify them in what way?

Michael

Hi @mppfor_manu

Sorry, I wasn’t clear. We like seeing the progress of our long-running workflows. Activit can render the diagram indicating which task is currently executing:

The tests need to know when the workflow completes execution. The taskService.complete method should be work for us.

Thanks for the pointers,
-dan

Camunda shows you the progress of running processes the same as your old system.

Hi @mppfor_manu, yes the Cockpit application shows the progress, but I need to be able to generate PNGs of the running process. Here’s the code we use in Activiti

            ProcessDiagramGenerator generator = ProcessEngines.getDefaultProcessEngine().getProcessEngineConfiguration().getProcessDiagramGenerator();
            return generator.generateDiagram(model, "png", runtimeService.getActiveActivityIds(processInstance.getId()));

Is there something similar in Camunda? I couldn’t find anything.

Thanks,
-dan

Are you saying you need to see the PNG as it would appear at a particular point in time? If that’s the case, you’re probably going to need to break open the Cockpit application to see how they did it.

I would guess that they are driving most of this with the bpmn.io library that they created. It’s the basis of Camunda modeler and other features of Camunda. I’m thinking that maybe you can drive creation of the image by querying the ACT_RU tables to determine the “state” of the process, then you would have to render that state via the bpmn.io library.

Again, I’d look to the Cockpit web application for guidance here.