What are you looking for?

How to use Camunda Platform 8 to Orchestrate Microservices

Check out this fun example using Camunda Platform 8 to coordinate the use of several popular internet services, providing a nice end-user experience.
  • Blog
  • >
  • How to use Camunda Platform 8 to Orchestrate Microservices

Camunda Platform 8 is great at orchestrating microservices. Here’s a fun example that shows how Camunda Platform 8 can coordinate the use of several popular internet services (Google Forms, Google Cloud Functions, SendGrid, and OpenAI) to provide a nice end-user experience.

The scenario—accept song requests for an event

Imagine you’re planning a family reunion, a school dance, a wedding, or a company retreat. You’re planning to have a DJ, Band, or Karaoke. You’d like to allow your friends to recommend songs for the party. Not all your friends have Facebook, or LinkedIn, but fortunately, they all have email addresses. You’d like to invite them to submit a form with a Song Artist and Title. Some of your friends think they’re witty and will probably submit silly song requests that shouldn’t be added to the official list. It’d be nice to automatically determine if a song request is appropriate for the event. Also, most of your friends have very short attention spans, so in case they open the email, and then get distracted, you should also send periodic reminders for them to send in their song request.

My solution

Here’s a solution I came up with to demonstrate how Camunda Platform 8 can be used to make this a nice experience for my friends and family while also automating as much as possible, so that there’s less work for me 💪

Uniquely identifying people (Authentication)

If everyone on my party invitation list were all on a single social network, then this would be a lot easier. Unfortunately, that’s not the case. For example, some of my friends and family are very active on Facebook, while others either don’t even have accounts, or haven’t logged on in years. This means there’s no central system which uniquely identifies all my friends and family. I don’t have the luxury of having a single source of truth, such as Active Directory, that contains account information for each invitee. Luckily, Camunda is flexible enough to work around this inconvenience. I’ll treat email addresses as a unique identifier for each of my friends and family. Think of this as an “ad-hoc” Identity Provider!

Sending reminders using SendGrid

Fortunately, everyone does have an email address. SendGrid is a very popular service for sending email notifications and so I can use that to send out reminder emails. In fact, I can use Camunda’s SendGrid Connector to send email notifications right from my Camunda process.

Collecting song requests using Google Forms

Of course, I could have easily implemented this using Camunda Forms and Tasklist. But since this is a demo on how to orchestrate several third party services, as an extra challenge, I chose to use Google Forms.

I’ll create a form that people can use to enter their Song Requests. My form needs to have the following fields:

  1. The Song Title
  2. The Song’s Artist
  3. A person’s email address

Here’s what the Google form will look like to my friends and family:

The Google Form with fields for Artist, Song Title and Email.

Publishing a message using Google Cloud Functions

There needs to be some way to communicate back to Camunda that a user has submitted a Google Form, which brings us to the most complicated part of my solution. When orchestrating microservices in general, there is usually a tradeoff between flexibility and complexity. Camunda strives to make simple things easy and difficult things possible.

I thought of two ways to solve this problem:

  1. One possible solution here would be to use an Inbound HTTP Webhook Connector. I could add logic that calls the webhook connector whenever one of my friends submits a Google Form. This could work nicely.
  2. For this example, I chose to take advantage of a more powerful (and more complex) solution of using a custom Zeebe Client to publish a message to the Camunda 8 Process engine. As a bonus, this way, I can also demonstrate how to coordinate yet another third party service, Google Cloud Functions 🙂

I can register a small bit of Google Apps Script that will run whenever someone submits my Google Form. The JavaScript will trigger a custom Google Cloud Function, which, in turn, will use a Java Zeebe Client to publish a message back to the Camunda 8 Zeebe Engine.

I could have hosted my Zeebe Client Java project anywhere that a Java project can be run, but in this case, I chose to use a Google Cloud Function.

Determine whether song is appropriate using OpenAI

After someone submits a song request, I want to check if it’s a “good” song 😛. As I’m writing this, in the Summer of 2023, the latest buzz, of course, is all about ChatGPT! So, I’ll use the Camunda 8 OpenAI Connector to send each song request to OpenAI’s Chat Completions Rest API in order to get an opinion about whether it’s a good song for the type of event! This should be fun 😀

Send final notification using SendGrid

After I hear back from the machine learning algorithm, I’ll send my friends one last email notification to let them know if the song was accepted or rejected. If the AI can’t tell if a song is appropriate, I’ll send an email to myself with a link to a form where I can manually review the song lyrics and either approve or reject. I’ll go ahead and use Camunda Forms and Tasklist for this manual review step.

The process diagram

Here’s my process diagram file named song-requests.bpmn that implements all the steps described above.

The BPMN diagram showing the process for song requests.

The start event of my process accepts three variables:

  1. A person’s Name (which I use to send personalized email notifications)
  2. A person’s Email (which I use to uniquely identify who is sending the request)
  3. An event type. This is optional. By default, this is set to “wedding.” But it’s also possible to pass in a different event type such as “Birthday Party,” or “Company Retreat.”

The first step in the process sends an email notification to the person.email with a link to the Google Form. The process then waits at an event gateway for one of two things to happen:

  1. Either my friend opens their email, and submits the form with a song title and artist. The Google Form includes an onsubmit trigger to call a custom Google Cloud Function which uses the Zeebe client to publish a message. The message triggers the “Form Submitted” intermediate message catch event.  
  2. Or, the timer will fire and another reminder email is sent

After the form is submitted, the OpenAI Connector makes a call to the Chat Completions REST API and asks whether this song title and artist is appropriate for the event.

OpenAI responds with either “Yes,” “No,” or “Maybe,” along with an explanation 😛

Running the solution, and some fun responses from ChatGPT

Here are steps to set this up to run on your own Camunda Platform 8 Cluster! And here are some fun responses from ChatGPT 😅

“Sorry, but your song request of ‘Fight for your right’ by Beastie Boys is not appropriate for this event. Here’s why: No, it is not appropriate for a wedding. The song is about partying and having fun, which is not usually the atmosphere at a wedding.”

Sorry, but your song request of ‘The Roof is on Fire’ by Rock Master Scott is not appropriate for this event. Here’s why: No, The song “The Roof is on Fire” by “Rock Master Scott” may not be appropriate for a Company Retreat as the lyrics can be considered provocative and may not align with the professional nature of a company retreat. Therefore, it may not be suitable to play it during the event.”

“Sorry, but your song request of ‘Pump Up The Jam’ by Technotronic is not appropriate for this event. Here’s why: No, “Pump Up The Jam” by “Technotronic” is not appropriate for a wedding because it is a high-energy dance song with explicit lyrics that may offend some guests and it does not fit the traditional mood of a wedding ceremony or reception.”

Many more possibilities

I hope this simple example gets your creative juices flowing and shows the potential for using Camunda Platform 8 to orchestrate microservices. There are already dozens of awesome Connectors available, and more are being added each release. This should make it possible to implement much more sophisticated business use cases than demonstrated here by this simple song request example.

We are also always interested to hear suggestions for new connectors, and it’s also easy to create your own.

And if Connectors are too abstract, for complete programmatic flexibility to integrate with any system in almost any programming language, don’t forget that you can always reach for a Zeebe Client (like I used in the Google Cloud Function described above).

Happy microservice orchestrating 😎

Try All Features of Camunda

Related Content

Process orchestration and automation can be a significant asset when business mergers, acquisitions, and divestitures occur.
Combine AI with process orchestration to leverage data in workflows that span multiple telecom systems for better predictions.
Monolithic platforms can struggle to keep pace with the complexity and demands of business operations today. Learn why and what you can do about it.