Hello, I am trying to check a form input (created in the tasklist) with a java class, before passing the values further into a gateway to check if one of the values(userid) is given or not.
package com.camunda.supportGroup17.ServiceTasks;
import java.util.logging.Logger;
import org.camunda.bpm.client.ExternalTaskClient;
public class AnfragePrüfen {
private final static Logger LOGGER = Logger.getLogger(AnfragePrüfen.class.getName());
public static void main(String[] args) {
ExternalTaskClient client = ExternalTaskClient.create()
.baseUrl("http://localhost:8080/engine-rest")
.asyncResponseTimeout(10000) // long polling timeout
.build();
// subscribe to an external task topic as specified in the process
client.subscribe("anfrage-prüfen")
.lockDuration(1000) // the default lock duration is 20 seconds, but you can override this
.handler((externalTask, externalTaskService) -> {
// Put your business logic here
// Get a process variable
String anfrage = (String) externalTask.getVariable("anfrage");
String email = (String) externalTask.getVariable("email");
String name = (String) externalTask.getVariable("name");
Long userid = (Long) externalTask.getVariable("userid");
LOGGER.info("Query has been created with information: '" + anfrage + "'user info: '" + email +" "+ name +"' and user ID: "+ userid);
// Complete the task
externalTaskService.complete(externalTask);
})
.open();
}
}
Model:
process.bpmn (5.8 KB)
Error msg:
java.lang.AssertionError: Expecting ProcessInstance {id=‘4’, processDefinitionId=‘ServiceTasks:1:3’, businessKey=‘null’} to be ended, but it is not!. (Please make sure you have set the history service of the engine to at least ‘activity’ or a higher level before making use of this assertion!)
What am I doing wrong?