本文整理匯總了Java中feign.opentracing.hystrix.TracingConcurrencyStrategy類的典型用法代碼示例。如果您正苦於以下問題:Java TracingConcurrencyStrategy類的具體用法?Java TracingConcurrencyStrategy怎麽用?Java TracingConcurrencyStrategy使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TracingConcurrencyStrategy類屬於feign.opentracing.hystrix包,在下文中一共展示了TracingConcurrencyStrategy類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: alohaService
import feign.opentracing.hystrix.TracingConcurrencyStrategy; //導入依賴的package包/類
/**
* This is were the "magic" happens: it creates a Feign, which is a proxy interface for remote calling a REST endpoint with
* Hystrix fallback support.
*
* @return The feign pointing to the service URL and with Hystrix fallback.
*/
@Produces
@Singleton
private AlohaService alohaService(Tracer tracer) {
// bind current span to Hystrix thread
TracingConcurrencyStrategy.register();
return HystrixFeign.builder()
// Use apache HttpClient which contains the ZipKin Interceptors
.client(new TracingClient(new ApacheHttpClient(HttpClientBuilder.create().build()), tracer))
// Bind Zipkin Server Span to Feign Thread
.logger(new Logger.ErrorLogger()).logLevel(Logger.Level.BASIC)
.decoder(new JacksonDecoder())
.target(AlohaService.class,"http://aloha:8080/",
() -> Collections.singletonList("Aloha response (fallback)"));
}
示例2: holaService
import feign.opentracing.hystrix.TracingConcurrencyStrategy; //導入依賴的package包/類
/**
*
* This is were the "magic" happens: it creates a Feign, which is a proxy interface for remote calling a
* REST endpoint with Hystrix fallback support.
*/
@Bean
public HolaService holaService(Tracer tracer) {
// bind current span to Hystrix thread
TracingConcurrencyStrategy.register();
return HystrixFeign.builder()
.client(new TracingClient(new ApacheHttpClient(HttpClientBuilder.create().build()), tracer))
.logger(new Logger.ErrorLogger()).logLevel(Logger.Level.BASIC)
.decoder(new JacksonDecoder())
.target(HolaService.class, "http://hola:8080/",
() -> Collections.singletonList("Hola response (fallback)"));
}
示例3: hystrixTracingConcurrencyStrategy
import feign.opentracing.hystrix.TracingConcurrencyStrategy; //導入依賴的package包/類
@Bean
TracingConcurrencyStrategy hystrixTracingConcurrencyStrategy(Tracer tracer) {
return TracingConcurrencyStrategy.register(tracer);
}
示例4: HystrixFeign
import feign.opentracing.hystrix.TracingConcurrencyStrategy; //導入依賴的package包/類
@Autowired
public HystrixFeign(Tracer tracer) {
TracingConcurrencyStrategy.register(tracer);
}