Skip to content

Commit

Permalink
Fixed script healthcheck with Consul 1.x
Browse files Browse the repository at this point in the history
Consul client updated (version properties externalised)
Updated code to use new args(...) function instead of script(...)
  • Loading branch information
Verdoso committed Aug 31, 2018
1 parent 024da5a commit 80c570e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
12 changes: 6 additions & 6 deletions build.gradle
Expand Up @@ -24,14 +24,14 @@ targetCompatibility = 1.6

dependencies {

compile group: 'com.hazelcast', name: 'hazelcast', version:'3.+'
compile group: 'com.orbitz.consul', name: 'consul-client', version:'0.17.1'
compile group: 'commons-codec', name: 'commons-codec', version:'1.8'
compile group: 'com.hazelcast', name: 'hazelcast', version:"${hazelcast_version}"
compile group: 'com.orbitz.consul', name: 'consul-client', version:"${consul_client_version}"
compile group: 'commons-codec', name: 'commons-codec', version:"${commons_codec_version}"

// for consul-client
testCompile 'org.apache.cxf:cxf-rt-rs-client:3.0.3'
testCompile 'org.apache.cxf:cxf-rt-transports-http-hc:3.0.3'
testCompile 'junit:junit:4.12'
testCompile "org.apache.cxf:cxf-rt-rs-client:${cxf_rt_version}"
testCompile "org.apache.cxf:cxf-rt-transports-http-hc:${cxf_rt_version}"
testCompile "junit:junit:${junit_version}"

}

Expand Down
7 changes: 7 additions & 0 deletions gradle.properties
@@ -1,2 +1,9 @@
version=1.0-RC8
description=hazelcast-consul-discovery-spi - Consul based discovery strategy SPI for Hazelcast enabled applications

hazelcast_version=3.+
consul_client_version=1.2.4
commons_codec_version=1.8

cxf_rt_version=3.0.3
junit_version=4.12
2 changes: 1 addition & 1 deletion settings.gradle
@@ -1 +1 @@
rootProject.name = 'hazelcast-consul-discovery-spi'
rootProject.name = 'verdoso-hazelcast-consul-discovery-spi'
@@ -1,5 +1,6 @@
package org.bitsofinfo.hazelcast.discovery.consul;

import java.util.Arrays;
import java.util.Map;

import com.hazelcast.logging.ILogger;
Expand Down Expand Up @@ -43,7 +44,7 @@ public RegCheck buildRegistrationCheck(Map<String, Object> registratorConfig, Ad
String healthCheckScript = rawScript.replaceAll(HEALTH_SCRIPT_TEMPLATE_MYIP, localAddress.getInetAddress().getHostAddress())
.replaceAll(HEALTH_SCRIPT_TEMPLATE_MYPORT, String.valueOf(localAddress.getPort()));

regCheck = Registration.RegCheck.script(healthCheckScript, healthCheckScriptIntervalSeconds);
regCheck = Registration.RegCheck.args(Arrays.asList(healthCheckScript.split(" ")), healthCheckScriptIntervalSeconds);
}

}catch(Exception e){
Expand Down

0 comments on commit 80c570e

Please sign in to comment.