Actuator health endpoint #2

Merged
schatz merged 3 commits from add_health_endpoint into master 2024-06-12 13:00:30 +02:00
2 changed files with 5 additions and 6 deletions
Showing only changes of commit 0c256ea06f - Show all commits

View File

@ -20,7 +20,7 @@ public class SolrStartupHealthCheck implements ApplicationRunner {
private SolrRepository solrRepository;
@Override
public void run(ApplicationArguments args) throws Exception {
public void run(ApplicationArguments args) throws RuntimeException {
try {
if (solrRepository.ping().getStatus() != 0) {
throw new RuntimeException("Could not ping Solr cluster at startup");

View File

@ -43,16 +43,15 @@ public class SolrConnectionManager {
// create SolrClient with ZooKeeper hosts
// TODO: add socket (or connection) timeout?
solrClient = new CloudSolrClient.Builder(zkHosts, Optional.empty())
.withConnectionTimeout(15000)
.withSocketTimeout(1000)
// time to wait when trying to establish a connection
.withConnectionTimeout(3000)
// time to wait for data to be read from the socket
.withSocketTimeout(30000)
.build();
// set the appropriate Solr collection
((CloudSolrClient) solrClient).setDefaultCollection(solrProperties.getCollection());
// uncomment ping below, to crash app on startup if Solr is not available
// this.ping();
}
public SolrPingResponse ping() throws IOException, SolrServerException {