Last active
August 29, 2015 14:04
-
-
Save hlassiege/27bd5a5e5bc8bb1da94c to your computer and use it in GitHub Desktop.
JestHealth
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"status": "UP", | |
"jestHealth": | |
{ | |
"status": "UP", | |
"lastQuerySuccess": true | |
}, | |
"rabbit": | |
{ | |
"status": "UP", | |
"version": "3.3.4" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hopwork.hopsearch; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | |
import org.springframework.context.annotation.ComponentScan; | |
import org.springframework.context.annotation.Configuration; | |
@Configuration | |
@EnableAutoConfiguration | |
@ComponentScan(value = {"com.hopwork", "com.lateralthoughts"}) | |
public class HopSearchApplication { | |
public static void main(String[] args) throws Exception { | |
SpringApplication.run(HopSearchApplication.class, args); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component | |
public class JestHealth implements HealthIndicator { | |
@Autowired | |
private JestClient client; | |
@Override | |
public org.springframework.boot.actuate.health.Health health() { | |
Health health = new Health.Builder().build(); | |
try { | |
JestResult execute = client.execute(health); | |
return org.springframework.boot.actuate.health.Health.up().withDetail("lastQuerySuccess", execute.isSucceeded()).build(); | |
} catch (Exception e) { | |
return org.springframework.boot.actuate.health.Health.down(e).build(); | |
} | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Spring boot --> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-amqp</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-security</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-actuator</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-web</artifactId> | |
</dependency> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment