summaryrefslogtreecommitdiff
path: root/src/main/java/com/p4square/grow/ccb
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2018-01-29 20:23:59 -0800
committerJesse Morgan <jesse@jesterpm.net>2018-01-29 20:23:59 -0800
commitb4b71b902493cac1e5b57c70ab53961c26ceb323 (patch)
treed529a306c3203b9a942464b15225511b7b3fc12e /src/main/java/com/p4square/grow/ccb
parent8e7a0c2442674ee95b4ed2453436b6e20c153118 (diff)
Adding /ping resource for deep health checks
Diffstat (limited to 'src/main/java/com/p4square/grow/ccb')
-rw-r--r--src/main/java/com/p4square/grow/ccb/ChurchCommunityBuilderIntegrationDriver.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/com/p4square/grow/ccb/ChurchCommunityBuilderIntegrationDriver.java b/src/main/java/com/p4square/grow/ccb/ChurchCommunityBuilderIntegrationDriver.java
index 3704fdc..dd62401 100644
--- a/src/main/java/com/p4square/grow/ccb/ChurchCommunityBuilderIntegrationDriver.java
+++ b/src/main/java/com/p4square/grow/ccb/ChurchCommunityBuilderIntegrationDriver.java
@@ -6,9 +6,11 @@ import com.p4square.ccbapi.CCBAPIClient;
import com.p4square.grow.config.Config;
import com.p4square.grow.frontend.IntegrationDriver;
import com.p4square.grow.frontend.ProgressReporter;
+import org.apache.log4j.Logger;
import org.restlet.Context;
import org.restlet.security.Verifier;
+import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -17,6 +19,8 @@ import java.net.URISyntaxException;
*/
public class ChurchCommunityBuilderIntegrationDriver implements IntegrationDriver {
+ private static final Logger LOG = Logger.getLogger(ChurchCommunityBuilderIntegrationDriver.class);
+
private final Context mContext;
private final MetricRegistry mMetricRegistry;
private final Config mConfig;
@@ -65,4 +69,18 @@ public class ChurchCommunityBuilderIntegrationDriver implements IntegrationDrive
public ProgressReporter getProgressReporter() {
return mProgressReporter;
}
+
+ @Override
+ public boolean doHealthCheck() {
+ try {
+ // Try something benign, like getting the custom field labels,
+ // to verify that we can talk to CCB.
+ mAPI.getCustomFieldLabels();
+ return true;
+
+ } catch (IOException e) {
+ LOG.warn("CCB Health Check Failed: " + e.getMessage(), e);
+ return false;
+ }
+ }
}