Setting up your Telegram channel with Camunda Cloud
If you’re a runner, then you know it’s important to change your running shoes from time to time. I’ve run many miles with the Camunda Platform. I’ve used it for my own projects, for tutorials, and taught people how to use it in workshops. Now, it’s time to put on some new shoes: it’s time to automate a process with Camunda Cloud.
If you’ve also been using Camunda Platform and are interested in what it looks like to move to Camunda Cloud, come for a run with me.
In the continuing pandemic situation, I need to stay informed, and know as soon as the situation relaxes. I find myself checking the Corona numbers every day. A repetitive task? I thought: “this could use some automation to make my life easier. A message with the information should be sent every morning to my phone — and which app would be better for real facts than Telegram? Finally it is time for my own Telegram channel!”
And the good news you can be all part of it and subscribe here.
Building the model
Every day, an instance of the workflow is started. The first service calls an API to get the current Corona numbers for Germany. Luckily, someone already built an API ( I am always happy if I can include other Open Source projects) — so no need to query the Robert Koch Institute( RKI) Database. The RKI is the central health institution here in Germany that protects and improves the health of the population. In the current pandemic it gets all the numbers of new Corona cases, deaths and recoveries, monitors them and issues advice based on this information.
In Germany, politicians look closely at the weekly incident rate. If it is less than 35, the situation starts to relax. In that case, I’d like to receive a celebration message to buy some champagne. If the number is equal to or higher than 35, I’d like to be informed about it. But sometimes I feel demotivated if I see those high numbers. So, if the situation stays serious, I want to get fun activity suggestions for the day, so the lockdown doesn’t get boring.
I like to be transparent about where the information in my Telegram channel is coming from. You want to know where the “real” facts are coming from. So here is the matching BPMN model for it:
Time to get hands on: Prepare the model for deployment
Let’s have a look at the technical attributes we have to set before we can deploy the model to the cloud. The BPMN elements we have to consider are the same as for Camunda Platform, but the configuration differs slightly, as Camunda Cloud uses Zeebe as a workflow engine. If we look at the architecture, each engine is built completely differently. Here, I’ll mention the differences from an user perspective:
- For the sequence flows after the XOR gateway we need to provide expressions. The Camunda BPM engine uses the Unified Expression Language (UEL). Zeebe uses the Friendly Enough Expression Language (FEEL). I like how easy it is to access JSON with FEEL, and found it quite powerful when it comes to calculations and more complex expressions. For the Camunda Platform you can include the SPIN library, which then also offers you easy access to JSON and XML variables.
- Unlike the Camunda Platform, Zeebe does not support CRON for timer definitions. So what should I do if I want to start my process every day at 10:00 am to get my update information? Well my hacky solution is that I set the timer definition to R/PT24H and then deploy the process to the time I want to have it executed every day. If you have a process that should run every night at 03:00 am you are lucky and don’t have to live with my solution, which would be probably unhealthy for your sleep depending how often you need to deploy new versions. The same question was raised in the Zeebe Forum and Philipp Ossler provided the solution to calculate the duration using FEEL. So no need to get up for your deployments.
- As we don’t embed the engine, but have a fully standalone engine with Camunda Cloud, the way to implement service tasks are Workers. They are similar to the External Task Workers from the Camunda Platform. Equivalent to the topic in Camunda Platform, we set a type here.
- Good news for everyone who struggled with asynchronous before and after, we don’t need to care about those flags, as in Zeebe everything is asynchronous continuation. That also can lead to the situation where you see an incident occurring at the XOR gateway. This was a surprise to me when I first deployed a model that had a malformed expression at a sequence flow.
Build the workers for your process
Deploy the model
There are multiple ways to deploy the process model to Camunda Cloud: you can use the Zeebe Modeler desktop app and connect it with your cluster, or you can build your own client to connect and deploy the model to your cluster. If you want to try out something quick, the Cloud console offers a modeler too, and you can deploy directly from there. This makes the getting started experience even smoother.
At this point, I have deployed a process in Camunda Cloud, and it is running. Every morning, I get my Corona news in my Telegram channel.
It takes some time to break in new running shoes. Things you are used to are slightly different. There will be some pressure points — like configuring a timer event that runs every day at 10:00 am. But, I promise: if you have mastered setting up the Camunda Platform in the past, then Camunda Cloud won’t be a hurdle that will stop you in your tracks. And, if you’ve always had a hobby project in mind that involves a process, maybe it’s time to try it out without the need to run a process engine on your machine. If you don’t have a project in mind, you can use mine, and start your own Telegram channel. You can find the project on GitHub. Pull requests are very welcome — especially the worker that chooses a random activity. I would be happy to extend the list of activities.
It is always good to have a second pair of running shoes. This is just my start with Camunda Cloud and I am curious and excited to find out what the next miles will bring!