Java client throw io.grpc.StatusRuntimeException: UNAVAILABLE: Channel shutdownNow invoked when sending message to zeebe

HI,
I use the following code to send message to Zeebe receive task. But it failed sometimes.

try (ZeebeClient client = ZeebeClientFactory.getZeebeClient()) {

        client.newPublishMessageCommand()
                .messageName(messageName)
                .correlationKey(correlationKey)
               // .variables("{\"payload\":\""+ "payload“+ correlationKey +"\"}")
                .send()
                //.join();

                .whenComplete((result, exception) -> {
                    if (exception == null) {

                        LOG.info("successfully sent message :{},{}", correlationKey, result);
                    } else {
                        LOG.error("Failed to sent message{},{}", correlationKey, exception);
                        exception.printStackTrace();
                    }
                });
        sleep(100);
    }

The execption is

io.grpc.StatusRuntimeException: UNAVAILABLE: Channel shutdownNow invoked
at io.grpc.Status.asRuntimeException(Status.java:535)
at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:478)
at io.grpc.internal.DelayedClientCall$DelayedListener$3.run(DelayedClientCall.java:463)
at io.grpc.internal.DelayedClientCall$DelayedListener.delayOrExecute(DelayedClientCall.java:427)
at io.grpc.internal.DelayedClientCall$DelayedListener.onClose(DelayedClientCall.java:460)
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:562)
at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:70)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:743)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:722)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)

Who can help on that? Thanks

Hi @lynn,

The failure message indicates that the connection was closed. Probably, because the Gateway restarted.

How often do you see this failure?
Do you monitor the Gateway and Broker restarts?

Best regards,
Philipp