timeout props
This commit is contained in:
parent
652c4b9952
commit
ad4d4b28a2
|
@ -32,7 +32,9 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||||
@EnableSwagger2
|
@EnableSwagger2
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
@EnableElasticsearchRepositories(basePackageClasses = { Event.class, Notification.class })
|
@EnableElasticsearchRepositories(basePackageClasses = {
|
||||||
|
Event.class, Notification.class
|
||||||
|
})
|
||||||
public class LiteratureBrokerServiceConfiguration extends AbstractElasticsearchConfiguration {
|
public class LiteratureBrokerServiceConfiguration extends AbstractElasticsearchConfiguration {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(LiteratureBrokerServiceConfiguration.class);
|
private static final Log log = LogFactory.getLog(LiteratureBrokerServiceConfiguration.class);
|
||||||
|
@ -50,8 +52,10 @@ public class LiteratureBrokerServiceConfiguration extends AbstractElasticsearchC
|
||||||
@Bean
|
@Bean
|
||||||
public RestHighLevelClient elasticsearchClient() {
|
public RestHighLevelClient elasticsearchClient() {
|
||||||
final ClientConfiguration clientConfiguration = ClientConfiguration.builder()
|
final ClientConfiguration clientConfiguration = ClientConfiguration.builder()
|
||||||
.connectedTo(elasticSearchProperties.getClusterNodes())
|
.connectedTo(elasticSearchProperties.getClusterNodes())
|
||||||
.build();
|
.withConnectTimeout(elasticSearchProperties.getConnectionTimeout())
|
||||||
|
.withSocketTimeout(elasticSearchProperties.getSocketTimeout())
|
||||||
|
.build();
|
||||||
return RestClients.create(clientConfiguration).rest();
|
return RestClients.create(clientConfiguration).rest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,24 +64,20 @@ public class LiteratureBrokerServiceConfiguration extends AbstractElasticsearchC
|
||||||
log.info("Initializing SWAGGER...");
|
log.info("Initializing SWAGGER...");
|
||||||
|
|
||||||
return new Docket(DocumentationType.SWAGGER_2)
|
return new Docket(DocumentationType.SWAGGER_2)
|
||||||
.select()
|
.select()
|
||||||
.apis(RequestHandlerSelectors.any())
|
.apis(RequestHandlerSelectors.any())
|
||||||
.paths(p -> p.startsWith("/api/"))
|
.paths(p -> p.startsWith("/api/"))
|
||||||
.build()
|
.build()
|
||||||
.tags(
|
.tags(new Tag(TAG_EVENTS, "Events management"), new Tag(TAG_SUBSCRIPTIONS, "Subscriptions management"), new Tag(TAG_NOTIFICATIONS,
|
||||||
new Tag(TAG_EVENTS, "Events management"),
|
"Notifications management"), new Tag(TAG_TOPIC_TYPES, "Topic types management"), new Tag(TAG_OPENAIRE, "OpenAIRE use case"))
|
||||||
new Tag(TAG_SUBSCRIPTIONS, "Subscriptions management"),
|
.apiInfo(new ApiInfo(
|
||||||
new Tag(TAG_NOTIFICATIONS, "Notifications management"),
|
"Literature Broker Service",
|
||||||
new Tag(TAG_TOPIC_TYPES, "Topic types management"),
|
"APIs documentation",
|
||||||
new Tag(TAG_OPENAIRE, "OpenAIRE use case"))
|
"1.1",
|
||||||
.apiInfo(new ApiInfo(
|
"urn:tos",
|
||||||
"Literature Broker Service",
|
ApiInfo.DEFAULT_CONTACT,
|
||||||
"APIs documentation",
|
"Apache 2.0",
|
||||||
"1.1",
|
"http://www.apache.org/licenses/LICENSE-2.0"));
|
||||||
"urn:tos",
|
|
||||||
ApiInfo.DEFAULT_CONTACT,
|
|
||||||
"Apache 2.0",
|
|
||||||
"http://www.apache.org/licenses/LICENSE-2.0"));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,10 @@ public class ElasticSearchProperties {
|
||||||
private String notificationsIndexName;
|
private String notificationsIndexName;
|
||||||
@NotNull
|
@NotNull
|
||||||
private String notificationsIndexType;
|
private String notificationsIndexType;
|
||||||
|
@NotNull
|
||||||
|
private long connectionTimeout;
|
||||||
|
@NotNull
|
||||||
|
private long socketTimeout;
|
||||||
|
|
||||||
public String getClusterNodes() {
|
public String getClusterNodes() {
|
||||||
return this.clusterNodes;
|
return this.clusterNodes;
|
||||||
|
@ -70,4 +74,20 @@ public class ElasticSearchProperties {
|
||||||
this.notificationsIndexType = notificationsIndexType;
|
this.notificationsIndexType = notificationsIndexType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getConnectionTimeout() {
|
||||||
|
return connectionTimeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConnectionTimeout(final long connectionTimeout) {
|
||||||
|
this.connectionTimeout = connectionTimeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getSocketTimeout() {
|
||||||
|
return socketTimeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSocketTimeout(final long socketTimeout) {
|
||||||
|
this.socketTimeout = socketTimeout;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ import eu.dnetlib.lbs.topics.TopicTypeRepository;
|
||||||
public class EventVerifier implements Predicate<Event> {
|
public class EventVerifier implements Predicate<Event> {
|
||||||
|
|
||||||
private final TopicTypeRepository topicTypeRepo;
|
private final TopicTypeRepository topicTypeRepo;
|
||||||
private final long MAX_DELAY = 5000; // 10 seconds
|
private final long MAX_DELAY = 30000; // 30 seconds
|
||||||
private Instant last = Instant.EPOCH;
|
private Instant last = Instant.EPOCH;
|
||||||
private List<Predicate<Event>> validators = new ArrayList<>();
|
private List<Predicate<Event>> validators = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -40,8 +40,8 @@ public class EventVerifier implements Predicate<Event> {
|
||||||
|
|
||||||
final Iterable<TopicType> iter = this.topicTypeRepo.findAll();
|
final Iterable<TopicType> iter = this.topicTypeRepo.findAll();
|
||||||
this.validators = StreamSupport.stream(iter.spliterator(), false)
|
this.validators = StreamSupport.stream(iter.spliterator(), false)
|
||||||
.map(TopicType::asValidator)
|
.map(TopicType::asValidator)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -23,9 +23,10 @@ lbs.database.url = ${spring.datasource.url}
|
||||||
|
|
||||||
|
|
||||||
# for localhost
|
# for localhost
|
||||||
lbs.elastic.clusterNodes = 127.0.0.1:9200
|
lbs.elastic.clusterNodes = 127.0.0.1:9200
|
||||||
lbs.elastic.homepage = http://
|
lbs.elastic.homepage = http://
|
||||||
|
lbs.elastic.socketTimeout = 30000
|
||||||
|
lbs.elastic.connectionTimeout = 30000
|
||||||
|
|
||||||
lbs.elastic.eventsIndexName = oa_events_beta
|
lbs.elastic.eventsIndexName = oa_events_beta
|
||||||
lbs.elastic.eventsIndexType = event
|
lbs.elastic.eventsIndexType = event
|
||||||
|
|
|
@ -141,6 +141,14 @@
|
||||||
<th class="col-xs-1">type</th>
|
<th class="col-xs-1">type</th>
|
||||||
<td class="col-xs-3">{{summary.elasticSearch.notificationsIndexType}}</td>
|
<td class="col-xs-3">{{summary.elasticSearch.notificationsIndexType}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="col-xs-4">socket timeout</th>
|
||||||
|
<td class="col-xs-8" colspan="3">{{summary.elasticSearch.socketTimeout}} ms</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="col-xs-4">connection timeout</th>
|
||||||
|
<td class="col-xs-8" colspan="3">{{summary.elasticSearch.connectionTimeout}} ms</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue