2017-06-06 3 views
0

mes propriétés hystrix de fichier local.properties sont comme ci-dessous.Comment vérifier les propriétés Matrics fonctionnent pour hystrix?

hystrix.command.FASTSearchPageCommand.execution.isolation.strategy=THREAD 
hystrix.command.FASTSearchPageCommand.execution.isolation.semaphore.maxConcurrentRequests=10 
hystrix.command.FASTSearchPageCommand.execution.isolation.thread.timeoutInMilliseconds=1000 

hystrix.command.FASTSearchPageCommand.execution.timeout.disabled=true 
hystrix.command.FASTSearchPageCommand.execution.timeout.enabled=false 

hystrix.command.FASTSearchPageCommand.execution.isolation.thread.interruptOnTimeout=true 
hystrix.command.FASTSearchPageCommand.fallback.isolation.semaphore.maxConcurrentRequests=10 
hystrix.command.FASTSearchPageCommand.fallback.disabled=false 
hystrix.command.FASTSearchPageCommand.fallback.enabled=true 


hystrix.command.FASTSearchPageCommand.circuitBreaker.disabled=false 
hystrix.command.FASTSearchPageCommand.circuitBreaker.enabled=true 
hystrix.command.FASTSearchPageCommand.circuitBreaker.requestVolumeThreshold=10 
hystrix.command.FASTSearchPageCommand.circuitBreaker.sleepWindowInMilliseconds=8000 
hystrix.command.FASTSearchPageCommand.circuitBreaker.errorThresholdPercentage=10 
hystrix.command.FASTSearchPageCommand.circuitBreaker.forceOpen=false 
hystrix.command.FASTSearchPageCommand.circuitBreaker.forceClosed=false 
hystrix.command.FASTSearchPageCommand.metrics.rollingStats.timeInMilliseconds=1000 
hystrix.command.FASTSearchPageCommand.metrics.rollingStats.numBuckets=5 
hystrix.command.FASTSearchPageCommand.metrics.rollingPercentile.enabled=true 
hystrix.command.FASTSearchPageCommand.metrics.rollingPercentile.timeInMilliseconds=100 
hystrix.command.FASTSearchPageCommand.metrics.rollingPercentile.bucketSize=10 
hystrix.command.FASTSearchPageCommand.metrics.healthSnapshot.intervalInMilliseconds=100 
fastSearch.executionTimeout=5000 

Alors, comment puis-je vérifier que tout fonctionne? Comme comment puis-je remarquer que mes propriétés de matrices fonctionnent. Si peut me donner un ensemble de code pour la méthode d'exécution et de secours.

Répondre

0

Je pense que vous pouvez trouver tous les documents ici: Hystrix docs

L'exemple tiré de leurs documents suit:

public class CommandThatFailsSilently extends HystrixCommand<String> { 

    private final boolean throwException; 

    public CommandThatFailsSilently(boolean throwException) { 
     super(HystrixCommandGroupKey.Factory.asKey("FASTSearchPageCommand")); 
     this.throwException = throwException; 
    } 

    @Override 
    protected String run() { 
     if (throwException) { 
      throw new RuntimeException("failure from CommandThatFailsFast"); 
     } else { 
      return "success"; 
     } 
    } 

    @Override 
    protected String getFallback() { 
     return null; 
    } 
}