Quick serverless start to Camunda Cloud Public Beta

Untangle the microservice mess by using serverless orchestration

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.

To create a serverless orchestration workflow, you need:

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

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.

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 app and create the first and only cluster we will use in this example.

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:

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:

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 in Camunda Cloud console to View Workflow Instances in Camunda Operate:

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

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.

Update 2020–10–08: With the Camunda Cloud coming out of beta, Zeebe Http Worker are no longer available in the cloud and you need to run it yourself, using docker or VM of your choice.

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.

Building an awesome new product in PR to help comms & marketing pros and CEOs build their brand awereness and reach more customers and investors.