Hystrix-Konfiguration für Leistungsschalter in Java

Bin ich eine Anwendung schreiben, und ich möchte zu implementieren circuit breaker Muster. Dies ist die Hystrix Command-Klasse, die ich geschrieben habe:

public class HystrixCommandNextGen extends HystrixCommand<ScriptContext> {

    private ScriptContext scriptctx;
    private ScriptFactory scriptFactory;
    private ScriptContext responseContext = null;

    private Logger logger = LoggerFactory.getLogger(HystrixCommandNextGen.class);

    public HystrixCommandNextGen(ScriptContext scriptctx, ScriptFactory scriptFactory) {
        super(
            Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("Thread_Pool"))
            .andCommandKey(HystrixCommandKey.Factory.asKey(scriptctx.getExecutionData(ExecutionParam.SCRIPTNAME)))
        );
        this.scriptctx = scriptctx;
        this.scriptFactory = scriptFactory;

        HystrixCommandProperties.Setter().withCircuitBreakerEnabled(true);
        HystrixCommandProperties.Setter().withCircuitBreakerRequestVolumeThreshold(150);
    }

    @Override
    protected ScriptContext run() throws Exception {
        scriptFactory.execute(scriptctx);
        return scriptctx;
    }

    @Override
    protected ScriptContext getFallback() {
        logger.error("FI is not responding: Error occurred in the execution of " + getClass().getSimpleName());
        return scriptctx;
    }
}

Ich bin nicht in der Lage zu verstehen, wie zu konfigurieren, die Anzahl der threads, Schwellenwert Zeit für die Leistungsschalter und die Anzahl der Zugriffe zu handhaben.

Es sei denn, ich missverstanden den code von Hystrix, diese beiden Anrufe, die Sie haben, um HystrixCommandProperties.Setter() sind nicht etwas zu tun, als nur das erstellen eines neuen Objekts des Typs Setter, und nicht tatsächlich die Einrichtung eine Globale Eigenschaft

InformationsquelleAutor Sumit Kumar | 2015-04-14

Schreibe einen Kommentar