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

**URL:** <https://forum.camunda.io/t/how-to-shutdown-a-zeebe-client-when-theres-no-broker/47773>\
**Category:** Discussion & Questions\
**Tags:** spring-boot-starter\
**Created:** [September 26, 2023, 7:49am UTC](https://forum.camunda.io/t/how-to-shutdown-a-zeebe-client-when-theres-no-broker/47773 "2023-09-26T07:49:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![OnnoH](https://forum.camunda.io/letter_avatar_proxy/v4/letter/o/f0a364/32.png) [@OnnoH](https://forum.camunda.io/u/OnnoH)\
**Post date:** [September 26, 2023, 7:49am UTC](https://forum.camunda.io/t/how-to-shutdown-a-zeebe-client-when-theres-no-broker/47773/1 "2023-09-26T07:49:19Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![nathan.loding](https://forum.camunda.io/user_avatar/forum.camunda.io/nathan.loding/32/24171_2.png) [@nathan.loding](https://forum.camunda.io/u/nathan.loding)\
**Post date:** [September 27, 2023, 6:54pm UTC](https://forum.camunda.io/t/how-to-shutdown-a-zeebe-client-when-theres-no-broker/47773/2 "2023-09-27T18:54:01Z")

</div>

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](https://github.com/camunda-community-hub/spring-zeebe#disabling-zeebeclient), and you can [disable individual workers](https://github.com/camunda-community-hub/spring-zeebe#disable-worker). 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`](https://github.com/camunda-community-hub/spring-zeebe) package, which that start is an example of, is a community maintained project. It looks like there is an [existing issue](https://github.com/camunda-community-hub/spring-zeebe/issues/434) 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.

---

<div class="post-metadata">

**Author:** ![OnnoH](https://forum.camunda.io/letter_avatar_proxy/v4/letter/o/f0a364/32.png) [@OnnoH](https://forum.camunda.io/u/OnnoH)\
**Post date:** [September 28, 2023, 8:43am UTC](https://forum.camunda.io/t/how-to-shutdown-a-zeebe-client-when-theres-no-broker/47773/3 "2023-09-28T08:43:24Z")

</div>

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

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…

---

<div class="post-metadata">

**Author:** ![system](https://forum.camunda.io/uploads/default/original/3X/5/8/58d50142eacca605d35cb1ef9e6b86ae85f49436.png) [@system](https://forum.camunda.io/u/system)\
**Post date:** [October 5, 2023, 8:44am UTC](https://forum.camunda.io/t/how-to-shutdown-a-zeebe-client-when-theres-no-broker/47773/4 "2023-10-05T08:44:08Z")

</div>

Closed on October 5, 2023, 8:44am UTC

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