Receive Task example code in Camunda cloud

Hi,

How do we publish message and complete the receive task in Camunda Cloud.

Can you please post sample code to implement in Java/Rest API.

Thanks,
Geetha

Hi @Geetha_k

Welcome to the forum.

Camunda 8 (nee Cloud) uses gRPC as it’s primary over-network protocol (rather than REST) You can read here in the docs about how you might want to send a message and complete a task.

If you’re using the Zeebe Client though you can use something like this:

  final PublishMessageResponse response = client.newPublishMessageCommand()
                .messageName(messageRequest.messageName)
                .correlationKey(messageRequest.correlationKey)
                .timeToLive(Duration.ofSeconds(Long.parseLong(messageRequest.ttl)))
                .variables("{\"TimeSent\":\""+ timestamp.toString()  +"\"}")
                .send()
                .join();
1 Like

Hi Niall,

Thanks for the response. I tried the same Zeebe client sample code you shared here, but still the task is waiting for the response and the operate I could see an incident with below message "failed to evaluate expression ‘msg’: no variable found for name ‘msg’.

Could you please help me here.

Thanks,
Geetha

Hi Niall,

I am able to resolve the issue. Thanks for your input.

Best Regards,
Geetha