Exception not getting raised in case of no message correlation

I am using below method for the message correlation but when message correlation doesnt happen, then also this method executes without any exception.
publishMessageResponse = zeebeClient
.send().exceptionally(throwable → {
throw new ZeebeException(“Could not correlate instance for correlationKey {” + correlationKey + “}”, throwable);

Can anyone please confirm what’s wrong with this code and if there is any work around

Hi @Pratiksha1205.
Message correlation in Camunda8 works differently than in Camunda7. In Camunda8 the message is published to the broker and buffered. That way it can even be correlated later on, if the message subscription is not yet in place at the time the message is published.
This also means that you won’t get feedback if the correlation took place or not. You’ll have to check that for yourself. E.g. using the simple monitor as mentioned here:

I guess that’s also why the endpoint is called PublishMessage and not CorrelateMessage.