Error: One of the attributes 'class', 'delegateExpression', 'type', or 'expression' is mandatory on serviceTask

Created a process below. Objective of the process is to call a REST URL through Service task after every certain timecycle(for testing I am doing every 2 minutes)

After this while trying to execute the spring code, getting the error as - *** One of the attributes ‘class’, ‘delegateExpression’, ‘type’, or ‘expression’ is mandatory on serviceTask…**

pom.xml (2.4 KB) process.bpmn (3.0 KB)

Which version of Camunda and which version of the modeler are you using?

Hi Niall,
Using modeler version of 4.8.1 and camunda version in pom.xml as 7.15.0.
It got fixed. juts added the below entry in POM.XML

 <dependency>
        <groupId>org.camunda.bpm</groupId>
        <artifactId>camunda-engine-plugin-connect</artifactId>
    </dependency>
    <dependency>
        <groupId>org.camunda.connect</groupId>
        <artifactId>camunda-connect-http-client</artifactId>
    </dependency>
1 Like

Glad to hear you’ve got it working :slight_smile:

@Niall , Thank you for the guidance and support. I have a requirement as below:
Outside of Camunda have to perform the below -

  1. Pull a json object from kafka cluster using kafkaListener.

  2. Once the JSON object is consumed in that kafkaconsumer class( service class in a spring boot as below ), that class should call/start a camunda process to validate the class. any idea how to call a process from service class
    ====================================
    @Service
    public class EventsstreamKafkaConsumer {

    private final Logger logger = LoggerFactory.getLogger(EventsstreamKafkaConsumer.class);
    @KafkaListener(topics = “test_topic” , groupId = “eventstreamgroup”)
    public void consumefromTopic (Event event)
    {
    logger.info(String.format(“Event is listened from Kafka Cluster through consumer api-> %s”, event));

    }

}

It depends,
If you’re using spring boot and KafkaConsumer is in the same application, you can just inject the RuntimeService as a bean and then start a process via the JavaAPI.

@Niall -Thank You. and is there any way I can pass my class object to a process while starting a process via Java API?

@Autowired
private RuntimeService runtimeService;

//implementation code goes here
Map<String, Object> processVariablesMap;

runtimeService.startProcessInstanceByKey(processDefinitionKey, businessKey,
						processVariablesMap)
1 Like

Thank You Sir for your help. Now, I am able to initiate the workflow from Springboot and able to pass the object. I created one User Task to validate the object value and I can see the desiralized content contains the object value. Would be great if you can guide on the required properties need to get configured so that I can pass this Object from one service task to another service task.

code is as below for ref:

  1. Code that initiate the workflow in Camunda and send the object

import java.util.HashMap;
import java.util.Map;
import org.camunda.bpm.engine.RuntimeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class EventWorkflowInitiator {

@Autowired
private RuntimeService runtimeService;

public void initiateworkflow(Event event)

{
	Map<String, Object> processVariablesMap = new HashMap<String, Object>();
	processVariablesMap.put("Event", event);

	runtimeService.startProcessInstanceByKey("EventStreamProcessId", processVariablesMap);
	
}

}

Code for next service task where I will be needed the Object to invoke that has been passed to CamundaEvent_1.bpmn (3.8 KB) .
@Component
public class EventParser implements JavaDelegate{

public void execute(DelegateExecution execution) throws Exception {
	System.out.println("within parser");
	
}