@Bean Request.Options feignOptions() { return new Request.Options(5000, 5000); }
@Bean @ConditionalOnProperty(value={"spring.fegin.request.connectTimeoutMillis","spring.fegin.request.readTimeoutMillis"}) @ConfigurationProperties(prefix = "spring.fegin.request") public Request.Options feignRequestOptions(){ return new Request.Options(); }
private Request.Options createRequestOptions() { return new Request.Options( Math.toIntExact(config.connectTimeout().toMillis()), Math.toIntExact(config.readTimeout().toMillis())); }
requestOptions = new Request.Options((int) TimeUnit.MINUTES.toMillis(10), (int) TimeUnit.MINUTES.toMillis(30));
.requestInterceptor(new TwitchClientIdInterceptor(this)) .retryer(new Retryer.Default(1, 10000, 3)) .options(new Request.Options(5000, 15000)) .target(TwitchHelix.class, baseUrl);
/** * Twitch API Client (Helix) * * @return TwitchHelix */ public TwitchMessagingInterface build() { log.debug("TMI: Initializing Module ..."); ConfigurationManager.getConfigInstance().setProperty("hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds", 2500); TwitchMessagingInterface client = HystrixFeign.builder() .encoder(new JacksonEncoder()) .decoder(new JacksonDecoder()) .logger(new Logger.ErrorLogger()) .errorDecoder(new TwitchMessagingInterfaceErrorDecoder(new JacksonDecoder())) .logLevel(Logger.Level.BASIC) .requestInterceptor(new TwitchClientIdInterceptor(this)) .retryer(new Retryer.Default(1, 10000, 3)) .options(new Request.Options(5000, 15000)) .target(TwitchMessagingInterface.class, baseUrl); // register with serviceMediator getEventManager().getServiceMediator().addService("twitch4j-api-tmi", client); return client; } }
/** * Twitch API Client (Kraken) * * @return TwitchKraken */ public TwitchKraken build() { log.debug("Kraken: Initializing Module ..."); ConfigurationManager.getConfigInstance().setProperty("hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds", 2500); TwitchKraken client = HystrixFeign.builder() .encoder(new JacksonEncoder()) .decoder(new JacksonDecoder()) .logger(new Logger.ErrorLogger()) .errorDecoder(new TwitchKrakenErrorDecoder(new JacksonDecoder())) .logLevel(Logger.Level.BASIC) .requestInterceptor(new TwitchClientIdInterceptor(this)) .retryer(new Retryer.Default(1, 10000, 3)) .options(new Request.Options(5000, 15000)) .target(TwitchKraken.class, baseUrl); // register with serviceMediator getEventManager().getServiceMediator().addService("twitch4j-kraken", client); return client; } }
private void initOpts(final JsonObject raw) { // Options JsonObject normalized = OPTIONS; if (raw.containsKey("timeout")) { final JsonObject options = raw.getJsonObject("timeout"); normalized = normalized.mergeIn(options); } this.options = new Request.Options( normalized.getInteger("connect"), normalized.getInteger("read")); // Defaults normalized = DEFAULTS; if (raw.containsKey("retry")) { final JsonObject defaults = raw.getJsonObject("retry"); normalized = normalized.mergeIn(defaults); } this.defaults = new Retryer.Default( normalized.getInteger("period"), normalized.getInteger("maxPeriod"), normalized.getInteger("attempts") ); } }
@Override public RibbonResponse execute(RibbonRequest request, IClientConfig configOverride) throws IOException { Request.Options options; if (configOverride != null) { RibbonProperties override = RibbonProperties.from(configOverride); options = new Request.Options( override.connectTimeout(this.connectTimeout), override.readTimeout(this.readTimeout)); } else { options = new Request.Options(this.connectTimeout, this.readTimeout); } Response response = request.client().execute(request.toRequest(), options); return new RibbonResponse(request.getUri(), response); }
@Override public RibbonResponse execute(RibbonRequest request, IClientConfig configOverride) throws IOException { Request.Options options; if (configOverride != null) { RibbonProperties override = RibbonProperties.from(configOverride); options = new Request.Options( override.connectTimeout(this.connectTimeout), override.readTimeout(this.readTimeout)); } else { options = new Request.Options(this.connectTimeout, this.readTimeout); } Response response = request.client().execute(request.toRequest(), options); return new RibbonResponse(request.getUri(), response); }
@Override public RibbonResponse execute(RibbonRequest request, IClientConfig configOverride) throws IOException { Request.Options options; if (configOverride != null) { options = new Request.Options( configOverride.get(CommonClientConfigKey.ConnectTimeout, connectTimeout), (configOverride.get(CommonClientConfigKey.ReadTimeout, readTimeout))); } else { options = new Request.Options(connectTimeout, readTimeout); } Response response = request.client().execute(request.toRequest(), options); return new RibbonResponse(request.getUri(), response); }
private Request.Options createRequestOptions() { return new Request.Options( Math.toIntExact(config.connectTimeout().toMillis()), Math.toIntExact(config.readTimeout().toMillis())); }
@Bean public Request.Options options() { return new Request.Options(FIVE_SECONDS, FIVE_SECONDS); }
public <T> T buildWithoutInterceptor(int connectTimeoutMillis, int readTimeoutMillis, Class<T> target, String url) { return Feign.builder() .encoder(new Encoder.Default()).decoder(new GsonDecoder()) .options(new Request.Options(connectTimeoutMillis, readTimeoutMillis)) .client(newDefaultClientInstance()) .target(target, url); }
public <T> T build(String username, String password, int connectTimeoutMillis, int readTimeoutMillis, Class<T> target, String url) { return Feign.builder().requestInterceptor(new BasicAuthRequestInterceptor(username, password)) .encoder(new Encoder.Default()).decoder(new Decoder.Default()) .options(new Request.Options(connectTimeoutMillis, readTimeoutMillis)) .client(newDefaultClientInstance()) .target(target, url); }
@Bean public Request.Options options() { return new Request.Options(FIVE_SECONDS, FIVE_SECONDS); }
@Bean public Request.Options feignOptions () { return new Request.Options( connectTimeout * 1000 , readTimeout * 1000 ); } }
private Request.Options createRequestOptions() { return new Request.Options( Math.toIntExact(config.connectTimeout().toMillis()), Math.toIntExact(config.readTimeout().toMillis())); }
protected Request.Options createOptions() { RaptorHttpClientProperties httpClientProperties = getOptional(RaptorHttpClientProperties.class); if (httpClientProperties != null) { return new Request.Options(httpClientProperties.getConnectionTimeout(), httpClientProperties.getReadTimeout()); } return new Request.Options(); }
@Bean public Request.Options options() { return new Request.Options(connectTimeout, readTimeout); } }