How to send message to Zeebe by Spring Zeebe client?

Hello Everybody,
Could you help me, please, to know if it’s possible to send a message by Zeebe Java client (in handler section):

    final JobWorker jobWorker = client.newWorker().jobType(JOB_TYPE).handler(new WorkerJobHandler()).open();

    public class WorkerJobHandler implements JobHandler {
    public void handle(JobClient client, ActivatedJob job) {
     ... sendMessage(); ... 
    } }

or by Spring Zeebe client:

    @ZeebeWorker(type = "myJobWorkerType")
    public void myJobWorkerType(final JobClient client, final ActivatedJob job) {
     ... sendMessage(); ... 

It’s only Interface JobClient with short list of methods available.
But I need Interface ZeebeClient with method newPublishMessageCommand() witch I can use in Zeebe Java client, but not in Handler and not in Spring Zeebe client.
Maybe I don’t know something and it’s possible to send a message to Zeebe by Spring Zeebe client ?

If you use the plain Java Client, you have to take care of creating and managing access to the Zeebe Client yourself.
With the Spring Zeebe Client, you can inject the Zeebe client into your class:

private ZeebeClient client;

Afterward, you can use the client to with the mentioned newPublishMessageCommand() method to send a message to Zeebe. You can read more about it on the Spring Zeebe Client github page:

1 Like

Thank you Stephan ! It works ! :star_struck: