How to execute a workflow modelled with bpmn.io?

This is my 2nd question on the forum as a BpmnJS newbye (but who loves it after having spent a few days developing with it…).

I would like to add workflow capabilities to my client/server application:

  • the client uses Angular, and would allow users to model workflows with BpmnJS, that would then run on the server.
  • the server runs on Node/Express, and would have to execute workflows stored in a MySQL database.

Right now I am confident to be able to use BpmnJS so that it fits with my business requirements, and let users model workflows in the Angular client.

What is not clear to me, is how to then transfer the workflow models to the server, and execute them.

My assumption is that I would have to transfer the BPMN-2.0 XML file from the client to the server, so that the server stores that XML in a SQL blob in the database.

However, in order to implement the handling of the various activities/events/branches, I think it would be better that I store each node of the diagram as individual records in the database, each having its own properties.
On the other hand, storing the XML is required (I assume), so that, at least, the (x,y) coordinates of each node can be restored when the user wants to visualize its workflows later on.
So I would have to store 2 redundant (thus possibly inconsistent) data: 1) the XML, and 2) the nodes/links structure.

So, a few questions:

  • what would be your recommendation to store a workflow modelled with BpmnJS in a database?
  • is there a BpmnJS API to retrieve the nodes and links from an XML file (and all their related attributes)
  • I have read and (mis?)understood on this forum that Camunda could be an alternative solution, that would avoid me to implement a workflow engine by myself. But then I don’t understand how to invoke my server-side functions to handle each activity/events/branches of the workflow from the Camunda engine. Do you think Camunda would be a good fit for me?
  • Overall, I have the impression to reinvent the wheel, but on this forum it looks like nobody has to do what I do, which puzzles me quite a bit, and make me think I have missed something.

Many thanks for any guidance!!
Best regards

Hi @bfredo123,

Cawemo (https://cawemo.com) already does this.

Each time you change the model, it is saved in a database in the cloud.

If you want to save executable process models, you can deploy them to a Camunda Platform installation with this Rest endpoint: Post Deployment | docs.camunda.org. But the model has to have enough technical properties to be executable: Executing automated steps (2/6) | docs.camunda.org. Otherwise the deployment API will reject the model with an error message.

Hope this helps, Ingo

2 Likes

Thank you, interesting, I will dig into this thanks to your links. However I would prefer that everything is hosted on my own server, rather than relying on 3rd party (especially because it would be easier for me to invoke code from within my server, rather than having to wrap everything in a REST API or so). So if anyone can give other feedback to my questions, this will be welcome as well.

Thanks again

Hi @bfredo123, glad you posted.

Long story short, you’d need a database to store diagrams that are currently being drawn. As @Ingo_Richtsmeier mentioned, this is exactly what Cawemo is. It embeds our tooling and POSTs diagrams on save to a backend service to persist it.

To execute diagrams choose any engine that understands BPMN. Be aware thought that engines typically require additional meta-data to be added to each diagram node, i.e. to specify which business logic to execute on a service task.

bpmn.io is built and maintained by Camunda and we offer tooling to build executable diagrams out of the box. But then again, it is your choice which engine you use. In fact, I’ve created a fairly complete process engine myself once. Surely a nice challenge, if you love to be challenged.

Thank you Nikku for your answer.

Meanwhile I have been contacted by PM to encourage me to have a look at Camunda, and I have to say I have now become a true Camunda fan!

I have struggled quite a bit with BpmnJS, which is a really great package, but I find it hard to see how to handle it cleanly and safely (I have found no documentation, maybe I missed something, so I browse the source code, the various samples, and this forum. If there is a documentation, which would help better understand the architecture and the concepts, I would love to learn).

And thanks to your answer, I discover this camunda-bpmn-js extension. I am not sure what it brings on top of bpmn-js, but will have a closer look.

And I also want to add that I find that the Camunda documentation is excellent, imho.

Best regards, and thank you again!

That sounds amazing.

You’re absolutely right about BpmnJS, being a little light on documentation to read. I suggest you to follow along the walkthrough and dive deeper with our examples, depending on your usage scenario, of course.

Hi, can someone please clarify in which country the bpmn.io (and demo.bpmn.io) drawings and related data are hosted?

The reason I ask is I have a client that has very strict rules about data residency.

Regards,
Lou

What hosted drawings are you referring to? demo.bpmn.io is frontend only and doesn’t store any of your BPMN diagrams.

Hi Philipp,
If no data is stored then thanks, that’s the information I was after.
Regards,
Lou