Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
camunda-external-task-client-js
Advanced tools
Implement your [BPMN Service Task](https://docs.camunda.org/manual/latest/user-guide/process-engine/external-tasks/) in NodeJS.
Implement your BPMN Service Task in NodeJS.
NodeJS >= v10 is required
npm install -s camunda-external-task-client-js
Or:
yarn add camunda-external-task-client-js
const { Client, logger } = require("camunda-external-task-client-js");
// configuration for the Client:
// - 'baseUrl': url to the Process Engine
// - 'logger': utility to automatically log important events
const config = { baseUrl: "http://localhost:8080/engine-rest", use: logger };
// create a Client instance with custom configuration
const client = new Client(config);
// susbscribe to the topic: 'creditScoreChecker'
client.subscribe("creditScoreChecker", async function({ task, taskService }) {
// Put your business logic
// complete the task
await taskService.complete(task);
});
Note: Although the examples used in this documentation use async await for handling asynchronous calls, you can also use Promises to achieve the same results.
External Tasks are service tasks whose execution differs particularly from the execution of other service tasks (e.g. Human Tasks). The execution works in a way that units of work are polled from the engine before being completed.
camunda-external-task-client.js allows you to create easily such client in NodeJS.
Done through polling.
// Susbscribe to the topic: 'topicName'
client.subscribe("topicName", async function({ task, taskService }) {
// Put your business logic
// Complete the task
await taskService.complete(task);
});
// Susbscribe to the topic: 'topicName'
client.subscribe("topicName", async function({ task, taskService }) {
// Put your business logic
// Handle a Failure
await taskService.handleFailure(task, {
errorMessage: "some failure message",
errorDetails: "some details",
retries: 1,
retryTimeout: 1000
});
});
// Susbscribe to the topic: 'topicName'
client.subscribe("topicName", async function({ task, taskService }) {
// Put your business logic
// Create some variables
const variables = new Variables().set('date', new Date());
// Handle a BPMN Failure
await taskService.handleBpmnError(task, "BPMNError_Code", "Error message", variables);
});
// Susbscribe to the topic: 'topicName'
client.subscribe("topicName", async function({ task, taskService }) {
// Put your business logic
// Extend the lock time
await taskService.extendLock(task, 5000);
});
// Susbscribe to the topic: 'topicName'
client.subscribe("topicName", async function({ task, taskService }) {
// Put your business logic
// Unlock the task
await taskService.unlock(task);
});
// Susbscribe to the topic: 'topicName'
client.subscribe("topicName", async function({ task, taskService }) {
// Task is locked by default
// Put your business logic, unlock the task or let the lock expire
// Lock a task again
await taskService.lock(task, 5000);
});
const { Variables } = require("camunda-external-task-client-js");
client.subscribe("topicName", async function({ task, taskService }) {
// get the process variable 'score'
const score = task.variables.get("score");
// set a process variable 'winning'
const processVariables = new Variables();
processVariables.set("winning", score > 5);
// set a local variable 'winningDate'
const localVariables = new Variables();
localVariables.set("winningDate", new Date());
// complete the task
await taskService.complete(task, processVariables, localVariables);
});
Have a look at our contribution guide for how to contribute to this repository.
The source files in this repository are made available under the Apache License Version 2.0.
FAQs
Implement your [BPMN Service Task](https://docs.camunda.org/manual/latest/user-guide/process-engine/external-tasks/) in NodeJS.
The npm package camunda-external-task-client-js receives a total of 9,273 weekly downloads. As such, camunda-external-task-client-js popularity was classified as popular.
We found that camunda-external-task-client-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.