How to shutdown a Zeebe client when there's no broker

Hello Camunda aficionados!

I’m developing a Job Worker in Spring Boot 3 with the starter io.camunda.spring.spring-boot-starter-camunda:8.2.4. The Zeebe engine runs in a Docker instance (image tag camunda/zeebe:8.2.12).

When the instance is up and I run the SB application, all’s good. When I (deliberately) shutdown it down and restart the app, the health check failed with an IO exception and the client starts flooding the logs with UNAVAILABLE: io exception / Connection refused: /127.0.0.1:26500 stack-traces.

All of this seems out of my control, but I would like to gracefully shut the app down and capture these exceptions. Is this something that can be configured with client properties? Or is this something that should be hooked into the starter dependency?

Hi @OnnoH - I am not aware of a way to conditionally disable the connection as you’ve described. You can disable the ZeebeClient in the properties, and you can disable individual workers. But those are “all or nothing,” rather that conditionally disabled based on the result of a health check.

In production, you would likely want your application to notify you if there are connectivity issues, so I would recommend a little bit of caution with such a conditional disabling of the services.

The spring-zeebe package, which that start is an example of, is a community maintained project. It looks like there is an existing issue requesting similar functionality. Because it is a community maintained project, it is always looking for community members to add new features and is always accepting new pull requests.

Thanks @nathan.loding for pointing to the issue. I upvoted it :wink:

Of course these issues rarely occur (I hope), but dumping a stacktrace every second isn’t good practice. In my use case I also use a Kafka consumer, which does the same thing if it can’t connect to a broker (albeit with more log-friendly messages, but a lot nonetheless).

If I have time, I’ll try to wrap my head around the package…

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