當前位置: 首頁>>代碼示例>>Java>>正文


Java TracingConcurrencyStrategy類代碼示例

本文整理匯總了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)"));
}
 
開發者ID:redhat-helloworld-msa,項目名稱:hola,代碼行數:23,代碼來源:TracingConfiguration.java

示例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)"));
}
 
開發者ID:redhat-helloworld-msa,項目名稱:ola,代碼行數:18,代碼來源:TracingConfiguration.java

示例3: hystrixTracingConcurrencyStrategy

import feign.opentracing.hystrix.TracingConcurrencyStrategy; //導入依賴的package包/類
@Bean
TracingConcurrencyStrategy hystrixTracingConcurrencyStrategy(Tracer tracer) {
  return TracingConcurrencyStrategy.register(tracer);
}
 
開發者ID:opentracing-contrib,項目名稱:java-spring-cloud,代碼行數:5,代碼來源:HystrixTracingAutoConfiguration.java

示例4: HystrixFeign

import feign.opentracing.hystrix.TracingConcurrencyStrategy; //導入依賴的package包/類
@Autowired
public HystrixFeign(Tracer tracer) {
  TracingConcurrencyStrategy.register(tracer);
}
 
開發者ID:opentracing-contrib,項目名稱:java-spring-cloud,代碼行數:5,代碼來源:FeignTracingAutoConfiguration.java


注:本文中的feign.opentracing.hystrix.TracingConcurrencyStrategy類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。