Is there an alternative to spaghetti?

When it comes to food, definitely not. Spaghetti Bolognese needs few ingredients, is quickly prepared and always tastes great – at least to me 😉 But what I am actually getting at? Spaghetti Code. In contrast to a meal, Spaghetti Code is not eaten up in a few minutes. It stays, is extended, changes, grows and grows and grows. It is the same with microservices. If you start with microservices, you always have to consider how fine-grained services are cut. In the end, the spaghetti effect shifts from code to orchestrating components. This component must know all the small services and connect them with each other. The same can be found in manual activities that have not been automated or digitalized so far. The process is laid down in a document that is constantly being expanded and changed. Above a certain size and amount of manual activity, maintenance is very expensive.

The described scenario is, of course, very exaggerated, and sometimes the spaghetti effects don’t occur after a certain period of time. Nevertheless, I can report from my own experience that (unfortunately) they far too often do.

But there are approaches that help to ensure structurereadability and above all maintainability. I would like to take a closer look at one approach here — executable processes or workflows. These include services such as ZapierPipedream or IFTTT. These services make it possible to define a process that is understandable and executable. But the services are either too limited or too specialized. A more flexible approach is offered with BPMN.

To put it (super) simply, software consists of an action and an execution. The execution can consist of several smaller tasks. At the end of the execution a result is generated.

async function doSomething() {
  const responses = await Promise.all([
    firstAsyncTask(), secondAsyncTask()
  if (responses[0].someAttribute === true) {
    // do some very complex things here
  } else {
    // do some even more complex things here

  if (responses[1].someOtherAttribute === false) {
    // http request to a random service

  return "a very hard-earned result"

async function firstAsyncTask(): Promise<{ someAttribute: boolean }> {
  return { someAttribute: true };
async function secondAsyncTask(): Promise<{ someOtherAttribute: boolean }> {
  return { someOtherAttribute: false };

If you try to explain an execution with more than two tasks to someone, you often use visual aids and write these tasks in circles or boxes, connect them, possibly add branches and so on. BPMN has standardized this visual description. And I would say that someone who has not read the BPMN specification can understand what is happening.

Alt Text

Now what would happen if this visual representation was technically executable? This is where workflow engines come into play. Essentially, the tasks only have to be configured so that they can be executed by software. This can be a script or an HTTP request.

So much for the theory — and for the wish list. And now you can safely think: sure, nice idea, but in practice it won’t work.

With this article I will try to convince you of the opposite. Since it’s not only about theory, I also want to encourage you to see the whole thing in action. You don’t need any BPMN knowledge, you don’t need any technical knowledge about workflow engines and you don’t need to install any software locally. All you need is a Camunda Cloud account and use Restzeebe to quickly see the results.

If you’ve made it so far, why not spend 10 more minutes? That’s all you need to get your first workflow up and running in the cloud.

Minute 1

Register for Camunda Cloud. Fill out the registration form and confirm your email address.

Minute 2

Log in to the cloud console and create your first cluster. Jump to the cluster details by clicking on the cluster.

Alt Text

Minute 3

Create an API client: this is necessary to communicate with your cluster. You can see it as a key to your cluster. Without this key the door to your cluster will remain closed. Once you have created your client, you will see a dialog with your credentials. You also have the possibility to download a file that contains export statements. This file is the easiest way, because it bundles all information in one file.

Minute 4

Log in to Restzeebe. You can answer a few questions about yourself that will help make the product better and then you’re ready to go.

Alt Text

Minute 5

Import the created client. When you have just downloaded the file, you can enter the entire content into the input field. The necessary information will then be extracted. Alternatively, you can enter all the necessary data one by one: ClusterId, ClientId and ClientSecret.

With the import, you have successfully completed the first achievement of Restzeebe.

Minute 6

In the next step, you interact with your cluster to get the status. If this action is successful, you have communicated with your cluster for the first time. So far it was relatively boring – you have, so to speak, given a ‘ping’ and received a ‘pong’.

Minutes 7 to 10

Now comes the exciting part 🙂 Deploy the first model. Restzeebe deploys a simple first workflow consisting of a start and end event. In between there is an intermediate message event. This means that a started instance waits in the message node until a message arrives that matches the configured parameters.

Open Operate (you’ll see the link is highlighted) to see your workflows and instances. Since you have only deployed one workflow so far, you will only see this entry on the dashboard.

Now start a new instance. Basically, you can start any workflow with Restzeebe. You only need the BPMN Process Id. Since you have deployed the workflow described above it makes sense to start a new instance. The BPMN Process Id of the workflow can be found in the response of the deployment. You have to enter this Id in the input field.

If you now jump back to Operate and refresh the page you will see an active instance. This instance is waiting in the message node.

In the last step you can now send a message to your cluster. In the description of the action, you will find an icon that pre-populates the input fields. Send the message and switch back to Operate. The instance should now be finished.

Congratulations, you have executed your first workflow in the cloud!

Isn’t that a bit too easy?

Admittedly it is a very simple workflow. I can only tell you that this is just the beginning. It is your Hello World process.

As described at the beginning, everything is a process. It is certainly not reasonable to model a workflow for every use case and let it run through a workflow engine. But there are enough examples where it makes more than sense.

I would like to finish this article with spaghetti. Can’t the spaghetti effect occur quickly as well when I design and execute processes? And the answer is very clear — yes. But the big difference from my point of view is that it is clearly visible.

I hope you did not expect an alternative recipe that plays in the league of Spaghetti Bolognese 😉

Let me know if the article was helpful! And if you like the content, you can follow me on TwitterLinkedIn or GitHub 🙂

This article was originally published on — you can read the original here.