Quick serverless start to Camunda Cloud Public Beta

Untangle the microservice mess by using serverless orchestration

Image for post
Image for post
Photo by Jason Leung on Unsplash

Intro

Have you heard about Camunda and Zeebe? Camunda is a company that does fantastic open-source BPMN engine and ecosystem around it, and also, they created the BPMN engine specifically designed to run cloud and serverless workloads — Zeebe.

2 days ago, they released a Public Beta of Zeebe SaaS called Camunda Cloud.

By using Camunda Cloud, you can create serverless workflows and orchestrate your microservice architecture without running an instance of Camunda BPMN or Zeebe in Docker or Kubernetes.

Here are the examples of the tasks suitable for serverless orchestration:

  • Order fulfillment
  • Underwriting
  • KYC
  • Follow-up email (1d, 5d, etc…)
  • Scheduled Batch processing
  • Custom CI/CD
  • Backups
  • User sign-up flow

Let’s have a quick example of creating a new workflow and executing it in Camunda Cloud.

First steps

To create a serverless orchestration workflow, you need:

Recommended reading

Getting started guide
https://zeebe.io/blog/2019/09/getting-started-camunda-cloud/

Zeebe Http Worker
https://github.com/zeebe-io/zeebe-http-worker

Creating first workflow

Image for post
Image for post
Screenshot of Zeebe Modeler

You can create a workflow in Zeebe Modeler, or you can download example workflow for my Serverless workflow orchestration talk from GitHub, see here: https://github.com/huksley/aws-detect-faces-workflow/blob/master/detect-faces-zeebe.bpmn

As we don’t have serverless functions running, we will use https://webhook.site/ to see any incoming requests from Camunda Cloud workflow running.

How workflow invokes serverless functions?

Currently, there is the only way to invoke them by using an HTTP worker, called CAMUNDA-HTTP. For this to work, you define headers and variables in the Service task, so HTTP worker knows what to invoke.

Define following headers:

  • url: ${baseUrl}?do=mytask1
  • method: post

Define following input variables:

  • source: name
  • target: body.name

By specifying this variables, ${baseUrl}?do=mytask1 will be called with POST and body will contain { name: “Value”} JSON.

Create cluster instance in Camunda Cloud

Go to Camunda Cloud and create the first and only cluster we will use in this example.

Image for post
Image for post
Example Camunda Cloud cluster

To receive requests, visit webhook.site and create a unique URL which will be a base address for every request we receive from Camunda Cloud workflow:

Image for post
Image for post
Listen for webhooks

Do not close this page! As your workflow executes, you will receive requests there and can inspect payloads.

Define your webhook.site URL in the HTTP worker variables:

Image for post
Image for post

Deploying workflow

By using zbctl, we can deploy workflow from the command line after creating it in Zeebe Modeler.

To do that, you need to copy and save cluster configuration and credentials as seen in Camunda Cloud — Zeebe Contact Point, clientId and clientSecret.

Deploying workflow using zbctl

If you encounter errors, fix them and redeploy them again. My example BPMN workflow should be compatible with version 0.22 of Zeebe running in the Camunda Cloud now.

After you created the workflow, you will get process id in bpmnProcessId variable:

{
“workflowKey”: 2251799813688076,
“bpmnProcessId”: “Process_1j8gwvl”,
“version”: 1,
“workflowInstanceKey”: 2251799813688081
}

Starting first instance

Now you can create execution that will call your services, and you will see invocation in webhook.site.

Using bpmnProcessId value after deploy workflow, create an instance by using zbctl:

Creating new execution

Now you got information about your new execution in JSON:

{
“workflowKey”: 2251799813688076,
“bpmnProcessId”: “Process_1j8gwvl”,
“version”: 1,
“workflowInstanceKey”: 2251799813688081
}

Tracking your executions in Camunda Operate

To see how your execution progresses, follow the link Camunda Cloud console View Workflow Instances in Camunda Operate:

Image for post
Image for post
Workflow and all instances for one version of process

It will show you all running, completed or failed executions for a version of workflow.

Receive workflow execution in Webhook.site

Image for post
Image for post
Track invocations

Going deeper

Great next actions are to read the documentation at https://docs.zeebe.io/, create new workflows in Zeebe Modeler, and run serverless functions to power your workflows.

About author

Ruslan Gainutdinov is an architect, DevRel, serverless, and workflow orchestration advocate and has more than 20 years of Software engineering experience.

If you have any questions, reach Ruslan on Twitter or LinkedIn.

Tech Lead & Software engineer with a passion for #DevRel, Serverless, Java, and Javascript. https://ruslan.org

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store