class QueueCircuitBreakerImpl implements QueueCircuitBreaker, RuleChangesObserver, Refreshable {

    @Override
    public Future<String> unlockNextQueue() {
        log.debug("About to unlock the next queue");
        Future<String> future = Future.future();
        queueCircuitBreakerStorage.popQueueToUnlock().setHandler(event -> {
            if (event.failed()) {
                future.fail(event.cause().getMessage());
                return;
            }
            String queueToUnlock = event.result();
            if (queueToUnlock != null) {
                unlockQueue(queueToUnlock).setHandler(event1 -> {
                    if (event1.failed()) {
                        future.fail(event1.cause().getMessage());
                        return;
                    }
                    future.complete(event1.result());
                });
            } else {
                future.complete(null);
            }
        });
        return future;
    }

    public  QueueCircuitBreakerImpl(Vertx vertx, Lock lock, String redisquesAddress, QueueCircuitBreakerStorage queueCircuitBreakerStorage, RuleProvider ruleProvider, QueueCircuitBreakerRulePatternToCircuitMapping ruleToCircuitMapping, QueueCircuitBreakerConfigurationResourceManager configResourceManager, Handler<HttpServerRequest> queueCircuitBreakerHttpRequestHandler, int requestHandlerPort);

}