How to implement Couchbase circuit breaker on State change event?

I have an implementation of the circuit breaker in one of our Spring Webflux applications.
Ref: followed sample

I need little support to implement the below things.

  1. I need to implement an event on the couchbase circuit breaker state change.
  2. I need a method that will return the current state of the couchbase circuit breaker.

I also posted the same question here.

Hi @Pothiq. Welcome to the Couchbase forum.

My teammate @graham.pople looked into this and determined there’s currently no way to inspect the circuit breaker status or listen for state changes. We’re tracking this as a pair of feature requests:

  • JCBC-2021 Add circuit breaker status to EndpointDiagnostics
  • JVMCBC-1168 Publish events when circuit breaker state changes

The idea is you’ll be able to get the current status of the circuit breakers (each endpoint has its own breaker) from the cluster diagnostics API.

For the state changes, the idea is you’ll be able to subscribe to the SDK’s event bus and listen for a circuit breaker state change event.

If you have a Couchbase Enterprise subscription, make sure to reach out to your Couchbase team if you want to request prioritization for these features.


I have subscribed to the event bus. From many events, I don’t know which condition helps me reach the circuit breaker state change. Do you have any advice on this?

Hi Pothiq,

There is not yet an event for the circuit breakers. I was only describing how it might work in the future. Sorry for the confusion.


1 Like

Added in Java SDK 3.4.1, available now. Example:

Cluster cluster = Cluster.connect("", "Administrator", "password");
DiagnosticsResult dr = cluster.diagnostics();
for (Map.Entry<ServiceType, List<EndpointDiagnostics>> entry : dr.endpoints().entrySet()) {
  System.out.println("Service Type: " + entry.getKey());
  for (EndpointDiagnostics endpoint : entry.getValue()) {
      "  Remote Address: " + endpoint.remote() +
        "  Circuit Breaker State: " + endpoint.circuitBreakerState()

Sorry, this didn’t make it into the 3.4.1 release. We’re still figuring out the best way to do it.


1 Like