Skip to content

Commit

Permalink
Make client connection timouts configurable.
Browse files Browse the repository at this point in the history
fixes #515.
  • Loading branch information
Anders Båtstrand authored and joshiste committed Aug 24, 2017
1 parent fd596ef commit 3dd252d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
8 changes: 8 additions & 0 deletions spring-boot-admin-docs/src/main/asciidoc/client.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,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
*/
Expand Down Expand Up @@ -92,6 +102,22 @@ public void setPeriod(int period) {
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ public ApplicationRegistrator registrator(AdminProperties admin,
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());
}
Expand Down

0 comments on commit 3dd252d

Please sign in to comment.