question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow to configure HttpClient used in ConsulClient

See original GitHub issue

It would be nice to introduce some kind of configurer or configuration properties which will allow to configure Apache HttpClient used in consul-api.

PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(registry);
			connectionManager.setMaxTotal(DEFAULT_MAX_CONNECTIONS);
			connectionManager.setDefaultMaxPerRoute(DEFAULT_MAX_PER_ROUTE_CONNECTIONS);

			RequestConfig requestConfig = RequestConfig.custom().
					setConnectTimeout(DEFAULT_CONNECTION_TIMEOUT).
					setConnectionRequestTimeout(DEFAULT_CONNECTION_TIMEOUT).
					setSocketTimeout(DEFAULT_READ_TIMEOUT).
					build();

			HttpClientBuilder httpClientBuilder = HttpClientBuilder.create().
					setConnectionManager(connectionManager).
					setDefaultRequestConfig(requestConfig);

			this.httpClient = httpClientBuilder.build();

Above you can find a code snippet from DefaultHttpsTransport, the same you can find in DefaultHttpTransport. It would be nice to be able to configure timeouts and connection limits (maxTotal, maxPerRoute).

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
spencergibbcommented, Jul 6, 2020

yes, once you have spring-cloud-starter-consul-config the consul client is created in bootstrap and auto configure before won’t work. You’d have to setup a bootstrap configuration

0reactions
urbanpawel90commented, Jul 8, 2020

@spencergibb Introducing bootstrap configuration helped. Thank you a lot! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Discovering Services - Steeltoe Documentation
The recommended approach for discovering services is to use HttpClient supplied through HttpClientFactory, augmented with the DiscoveryHttpMessageHandler ...
Read more >
Consul API client - Go Packages
NewHttpClient returns an http client configured with the given Transport and TLS config. func SetupTLSConfig ¶. func SetupTLSConfig(tlsConfig *TLSConfig) (*tls.
Read more >
Configuration Reference - Micronaut Documentation
Whether or not the configuration client should use Instance Principal ... consul.client.exception-on-error-status ... Http Client Core Config Properties.
Read more >
Service Discovery Using Consul And ASP.NET Core
The AddConsul method adds the Consul Client and its options to the service collection, along with a custom HTTP client that will be...
Read more >
Agents - Configuration File Reference | Consul
Use agent configuration files to assign attributes to agents and ... config_entries This object allows setting options for centralized config entries.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found