Search in sources :

Example 1 with Ping

use of uk.ac.ebi.spot.goci.curation.model.Ping in project goci by EBISPOT.

the class DailyEnsemblPing method pingEnsembl.

@Scheduled(cron = "0 0 7 * * *")
public void pingEnsembl() {
    RestTemplate restTemplate = new RestTemplate();
    String url = "http://rest.ensembl.org/info/ping?content-type=application/json";
    Ping ping = new Ping();
    try {
        ping = restTemplate.getForObject(url, Ping.class);
        Integer num = ping.getPing();
        getLog().info("Pinging Ensembl: " + url);
        if (num != 1) {
            mailService.sendEnsemblPingFailureMail();
            getLog().error("Pinging Ensembl returned " + num);
        } else {
            getLog().info("Pinging Ensembl returned " + num);
        }
    } catch (Exception e) {
        getLog().error("Pinging Ensembl failed", e);
        mailService.sendEnsemblPingFailureMail();
    }
}
Also used : Ping(uk.ac.ebi.spot.goci.curation.model.Ping) RestTemplate(org.springframework.web.client.RestTemplate) Scheduled(org.springframework.scheduling.annotation.Scheduled)

Aggregations

Scheduled (org.springframework.scheduling.annotation.Scheduled)1 RestTemplate (org.springframework.web.client.RestTemplate)1 Ping (uk.ac.ebi.spot.goci.curation.model.Ping)1