Commit 3dd252d9 by Anders Båtstrand Committed by Johannes Edmeier

Make client connection timouts configurable.

fixes #515.
parent fd596efb
......@@ -85,6 +85,14 @@ spring.boot.admin.password
| Interval for repeating the registration (in ms).
| `10.000`
| spring.boot.admin.connectTimeout
| Connect timeout for the registration (in ms).
| `5.000`
| spring.boot.admin.readTimeout
| Read timeout for the registration (in ms).
| `5.000`
| spring.boot.admin.auto-registration
| If set to true the periodic task to register the application is automatically scheduled after the application is ready.
| `true`
......
......@@ -36,6 +36,16 @@ public class AdminProperties {
private long period = 10_000L;
/**
* Connect timeout (in ms) for the registration.
*/
private int connectTimeout = 5_000;
/**
* Read timeout (in ms) for the registration.
*/
private int readTimeout = 5_000;
/**
* Username for basic authentication on admin server
*/
private String username;
......@@ -92,6 +102,22 @@ public class AdminProperties {
this.period = period;
}
public int getConnectTimeout() {
return connectTimeout;
}
public void setConnectTimeout(int connectTimeout) {
this.connectTimeout = connectTimeout;
}
public int getReadTimeout() {
return readTimeout;
}
public void setReadTimeout(int readTimeout) {
this.readTimeout = readTimeout;
}
public void setUsername(String username) {
this.username = username;
}
......
......@@ -47,7 +47,9 @@ public class SpringBootAdminClientAutoConfiguration {
ApplicationFactory applicationFactory,
RestTemplateBuilder restTemplBuilder) {
RestTemplateBuilder builder = restTemplBuilder.messageConverters(new MappingJackson2HttpMessageConverter())
.requestFactory(SimpleClientHttpRequestFactory.class);
.requestFactory(SimpleClientHttpRequestFactory.class)
.setConnectTimeout(admin.getConnectTimeout())
.setReadTimeout(admin.getReadTimeout());
if (admin.getUsername() != null) {
builder = builder.basicAuthorization(admin.getUsername(), admin.getPassword());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment