2

ドキュメンテーションによると、Feign with Hystrixを使用すると、すべてのリクエストがHystrixコマンドにラップされます。SpringクラウドでHystrixPropertyをFeignリクエストに設定する方法は?

これらのコマンドにHystrix Propertiesを設定することはできますか?私はこのような何かをしたいと思います:

@RequestMapping(commandProperties = { 
    @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "30000")}) 
List<Team> findAll(); 

かを:レコードの場合

@FeignClient(name = "teams", commandProperties = { 
    @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "30000")}) 

、私はすでにプロパティを使用しようとしたが、それはうまくいきませんでした。

hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=10000 
hystrix.command.findAll.execution.timeout.enabled=false 
hystrix.command.default.execution.timeout.enabled=false 

しかし、この1つはない:これらのものが働いている

//this property name is now misleading. //TODO figure out a good way to deprecate this property name 
    this.executionTimeoutInMilliseconds = getProperty(propertyPrefix, key, "execution.isolation.thread.timeoutInMilliseconds", builder.getExecutionIsolationThreadTimeoutInMilliseconds(), default_executionTimeoutInMilliseconds); 

EDIT: I確か

hystri‌​x.command.findAll.ex‌​ecution.isolation.thread.timeoutInMillis‌​econds=20000 

、我々はHystrixCommandPropertiesクラスに以下のコメントを読むことができますこれらのプロパティはhystrixに伝播していないようです。

+0

設定しようとしているプロパティのベースは、リクエストタイムアウトに対処しようとしていると思いますが、スタックトレースはありますか?リボンは関与していますか? –

+0

リモートサービスが応答するのに少し時間がかかるので、HystrixRuntimeException例外が発生します。 – Nicolas

+0

あなたは 'application.properties'でプロパティを設定しましたか? –

答えて

1

問題が解決しました。エンコードの問題でした。私はドキュメントから行をコピー/貼り付けていましたが、STSの表示は正しいものの、UTF-8でエンコードされていませんでした。

0

以下のようにプログラムでプロパティを設定することもできます。

ConfigurationManager.getConfigInstance() 
     .setProperty("hystri‌​x.command.default.ex‌​ecution.isolation.th‌​read.timeoutInMillis‌​econds", 1500); 
関連する問題