Camunda Node.js External Task Client 0.1.1 Released

We recently published the first alpha release of camunda-external-task-client-js,
an NPM module that makes it possible to handle your BPMN Service Tasks in Node.js.

Today, a new alpha release is ready, bringing up major features that revolve around easily exchanging process variables between
Service Tasks and the Workflow Engine.

The feature set includes:

  • Accessing single/all variables
  • Creating/Updating single or multiple variables
  • Support for primitive (e.g. Integer) and complex variable types (e.g. JSON)

Let’s walk through a basic example to showcase some of these features:

Example

A Workflow for Granting Loans

1. Running Camunda

First, make sure to have Camunda running.

2. Deploying the Workflow

Download the following model
and deploy it using the Camunda Modeler.

3. Installing the NPM package

Install camunda-external-task-client-js from npm using:

npm install -s camunda-external-task-client-js

Or:

yarn add camunda-external-task-client-js

4. Consuming Service Tasks in Node.js

const { Client, logger } = require('camunda-external-task-client-js');

// configuration for the Client:
//  - 'baseUrl': url to the Workflow Engine
//  - 'logger': utility to automatically log important events
const config = { baseUrl: 'https://localhost:8080/engine-rest', use: logger };

// create a Client instance with custom configuration
const client = new Client(config);

// create a handler for the task
const handler = async({ task, taskService }) => {
  // get task variable 'defaultScore'
  const defaultScore = task.variables.get('defaultScore');

  // set task variable 'creditScores'
  task.variables.set('creditScores', [defaultScore, 9, 1, 4, 10]);

  // complete the task
  try {
    await taskService.complete(task);
    console.log('I completed my task successfully!!');
  } catch (e) {
    console.error(`Failed completing my task, ${e}`);
  }
};

// subscribe to the topic 'creditScoreChecker' & provide the created handler
client.subscribe('creditScoreChecker', handler);

The output should be:

polling
✓ subscribed to topic creditScoreChecker
polling
✓ polled 10 tasks
✓ completed task 897ce191-2dea-11e8-a9c0-66b11439c29a

Documentation & More Detailed Examples

The main goal of this post is to show a basic usage of the new alpha release of camunda-external-task-client-js.
To find out about the full range of features, you can check the documentation
or a more in-depth example.

Feedback

Your feedback is extremely important, so don’t hesitate to share it with us by:

  • Monitoring Camunda Platform 7 with Prometheus

    Monitoring is an essential facet of running applications in a production system. Through this process, organizations collect and analyze data, and determine if a program is performing as expected within set boundaries. When combined with alerting, monitoring allows for detecting unexpected system behavior to mitigate exceptional situations as fast as possible. Furthermore, tracking the performance of a system enables organizations to improve those aspects that have the biggest impact with higher priority. One essential aspect of monitoring is the list of key metrics you want to observe. There are different categories of statistics that can be of interest here. To observe the defined metrics, there are plenty of application monitoring tools on the market today. They differ in many aspects...

    Read more
  • Securing Camunda 8 self-managed cluster and applications...

    Directory services are an effective way to manage an organization’s users, groups, printers, devices, and more. Most organizations accomplish this using Active Directory, Apache Directory, Oracle Internet Directory, or other similar tools. Recently I worked with a customer who wanted to see how he could secure the Camunda 8 Platform and process applications with such a directory. Their requirements consisted of: Allowing Directory users to access Camunda applications (Tasklist, Operate, Optimize) Accessing secured Tasklist & Operate APIs from our custom project Securing the custom project In this article, I’ll briefly explain the 3 easy steps taken to fulfill their requirements which include: Federate users from the Directory service into Keycloak Declare an application in Identity to access Camunda APIs Configure...

    Read more
  • Accelerate Connectivity with Camunda Platform 8.1

    We’re thrilled to announce Camunda Platform 8.1, the latest release of our process orchestration solution. This new version introduces features that accelerate connectivity to the many different systems and technologies that are required for true digital transformation, including: Create custom Connectors with our Integration Framework to accelerate connectivity New out-of-the-box Connectors for popular services Enhancements to Camunda Modeler that improve productivity Hot backups and official support for Amazon EKS and Red Hat OpenShift Plus, several upgrades requested by Camunda Platform 7 customers Organizations across all industries rely on complex technology stacks to adapt and enhance their operations in response to market dynamics, new disruptive companies, and increasing consumer expectations. Your technology stack likely includes everything from cutting-edge technologies to legacy...

    Read more

Ready to get started?

Still have questions?