Process variable not getting populated

I have created a BPMN file using camunda web modeler(file attached).
sensorid-io.bpmn (3.0 KB).

My aim is to move variable sensorId along the flow.

I start my spring based application, where I have defined worker as:

@Component
public class IoTMqttProcessor {

private final static Logger LOG = LoggerFactory.getLogger(IoTMqttProcessor.class);
@JobWorker(type = "iot-mqtt-processor")
public Map<String, String> processSensorMessage(@Variable(name = "sensorId") String sensorId) {
    LOG.info("Message from: {}", sensorId);
    return Map.of("sensorId", sensorId);
}

}

I run c8run to launch all needed components, then I deploy bpmn file using desktop modeler, and finally run with argument

{“sensorId” : “camera-123456789”}

Execution does come to processSensorMessage method but sensorId is always null.

What is missing in my setup or maybe bpmn file?

Hi @mghildiy
How do you run the workflow with the json argument ? Using desktop modeler ?

Yes.
First I deploy the process file using desktop modeler clicking on ‘rocket’ button.
Then I click on run button, and passing argument,as:

image

So entire setup has components:

my spring boot app
desktop modeler
camunda components(launched by executing c8run exe)

And my application.yaml is:

spring.application.name: IoT Workflow
server.port: 8084

camunda:
  client:
    mode: self-managed
    zeebe:
      enabled: true
      grpc-address: http://localhost:26500
      rest-address: http://localhost:8080

Your json argument has been overrided by output attribute of start flow node.

Delete it will be alright.

I removed the output attribute of start flow node, but unfortunately ‘sensorId’ is still received as null in job worker.
I am not sure why things are not working out of box for me.
iccc.bpmn (3.1 KB)

You also need to delete this

Thanks, it works now.

But what I want to achieve is to model start event as a message event. It is so because I have a mqtt listener which receives mqtt event and as i want to keep it running so I cant have it as a camunda task. So I plan to have start event of my process as a message event, which would be triggered from my mqtt listener for every mqtt event.

Is it possible? I see we have a kafka connector in Camunda, but not mqtt connector.

In my case I start a workflow by zeebe client api in a Scheduled method of SpringBoot. I think you can do it in your listener.
I don’t know if there is a better way. :grin:

Please remember to mark a thread as solved by marking the appropriate post as the solution. Since you’ve started a different thread on the MQTT Messages start portion of your issue, this thread seems to be complete.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.