When I type “node ./worker.js” I get an error message “polling failed with RequestError”. See below.
polling
V subscribed to topic charge-card
polling
? polling failed with RequestError: connect ECONNREFUSED 127.0.0.1:8080
The file worker.js contains the following :
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: ‘charge-card’
client.subscribe(‘charge-card’, async function({ task, taskService }) {
// Put your business logic here
// Get a process variable
const amount = task.variables.get(‘amount’);
const item = task.variables.get(‘item’);
console.log(Charging credit card with an amount of ${amount}€ for the item '${item}'...);
// Complete the task
await taskService.complete(task);
});
Hi @Niall, can you give some samples where get inputs and send to service task to call another API(POST call) , wait for response and call another API (POST call) etc.
Need bpnm file with javascripting, not java code as no complex logic involved than calling continuously APIs. Also it will be good, if it has some gateway when not 200 print some error message using inline scrpting.