/
HealthService.java
29 lines (22 loc) · 963 Bytes
/
HealthService.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package services;
import com.yammer.dropwizard.config.Bootstrap;
import com.yammer.dropwizard.config.Environment;
import services.doctor.Doctor;
import services.registry.ServiceRegistry;
import static org.quartz.JobBuilder.newJob;
public class HealthService extends com.yammer.dropwizard.Service<SkyDnsServiceConfiguration> {
public static void main(String[] args) throws Exception {
new HealthService().run(args);
}
@Override
public void initialize(Bootstrap<SkyDnsServiceConfiguration> bootstrap) {
bootstrap.setName("health");
bootstrap.addBundle(new SkyDnsHeartbeatBundle());
}
@Override
public void run(SkyDnsServiceConfiguration configuration, final Environment environment) {
ServiceRegistry registry = new ServiceRegistry(configuration.getSkyDnsHost(), ".skydns.local");
Doctor doctor = new Doctor();
environment.addResource(new HealthResource(registry, doctor));
}
}