Merge pull request #19 from BLasan/remove-eureka
Remove Eureka Client Side Load Balancing
diff --git a/api/src/main/java/org/apache/fineract/cn/rhythm/api/v1/client/RhythmManager.java b/api/src/main/java/org/apache/fineract/cn/rhythm/api/v1/client/RhythmManager.java
index cf2218a..1e246f9 100644
--- a/api/src/main/java/org/apache/fineract/cn/rhythm/api/v1/client/RhythmManager.java
+++ b/api/src/main/java/org/apache/fineract/cn/rhythm/api/v1/client/RhythmManager.java
@@ -32,7 +32,7 @@
* @author Myrle Krantz
*/
@SuppressWarnings("unused")
-@FeignClient(value="rhythm-v1", path="/rhythm/v1", configuration = CustomFeignClientsConfiguration.class)
+@FeignClient(path="/rhythm/v1", url = "http://${kubernetes.rhythm.service.name}:${kubernetes.rhythm.server.port}", configuration = CustomFeignClientsConfiguration.class)
public interface RhythmManager {
@RequestMapping(
value = "/clockoffset",
diff --git a/component-test/src/main/java/org/apache/fineract/cn/rhythm/AbstractRhythmTest.java b/component-test/src/main/java/org/apache/fineract/cn/rhythm/AbstractRhythmTest.java
index e276f0a..b016445 100644
--- a/component-test/src/main/java/org/apache/fineract/cn/rhythm/AbstractRhythmTest.java
+++ b/component-test/src/main/java/org/apache/fineract/cn/rhythm/AbstractRhythmTest.java
@@ -85,7 +85,7 @@
@Configuration
@EnableEventRecording
@EnableFeignClients(basePackages = {"org.apache.fineract.cn.rhythm.api.v1.client"})
- @RibbonClient(name = APP_NAME)
+ // @RibbonClient(name = APP_NAME)
@Import({RhythmConfiguration.class})
@ComponentScan("org.apache.fineract.cn.rhythm.listener")
public static class TestConfiguration {
diff --git a/service/build.gradle b/service/build.gradle
index 2e91004..c485992 100644
--- a/service/build.gradle
+++ b/service/build.gradle
@@ -46,7 +46,8 @@
dependencies {
compile(
[group: 'org.springframework.cloud', name: 'spring-cloud-starter-config'],
- [group: 'org.springframework.cloud', name: 'spring-cloud-starter-eureka'],
+ [group: 'org.springframework.boot', name: 'spring-boot-starter-web'],
+ // [group: 'org.springframework.cloud', name: 'spring-cloud-starter-eureka'],
[group: 'org.springframework.boot', name: 'spring-boot-starter-jetty'],
[group: 'org.apache.fineract.cn.rhythm', name: 'api', version: project.version],
[group: 'org.apache.fineract.cn.rhythm', name: 'spi', version: project.version],
diff --git a/service/src/main/java/org/apache/fineract/cn/rhythm/service/config/RhythmConfiguration.java b/service/src/main/java/org/apache/fineract/cn/rhythm/service/config/RhythmConfiguration.java
index 87d9523..8daddab 100644
--- a/service/src/main/java/org/apache/fineract/cn/rhythm/service/config/RhythmConfiguration.java
+++ b/service/src/main/java/org/apache/fineract/cn/rhythm/service/config/RhythmConfiguration.java
@@ -50,7 +50,7 @@
@SuppressWarnings("WeakerAccess")
@Configuration
@EnableAutoConfiguration
-@EnableDiscoveryClient
+// @EnableDiscoveryClient
@EnableApiFactory
@EnableAsync
@EnableCassandra
@@ -61,7 +61,7 @@
@EnableScheduling
@EnableTenantContext
@EnablePermissionRequestingFeignClient(feignClasses = {ApplicationPermissionRequestCreator.class})
-@RibbonClient(name = "rhythm-v1")
+// @RibbonClient(name = "rhythm-v1")
@EnableApplicationName
@EnableFeignClients(clients = {ApplicationPermissionRequestCreator.class})
@ComponentScan({
diff --git a/service/src/main/java/org/apache/fineract/cn/rhythm/service/internal/identity/ApplicationPermissionRequestCreator.java b/service/src/main/java/org/apache/fineract/cn/rhythm/service/internal/identity/ApplicationPermissionRequestCreator.java
index 3791e98..7684a5b 100644
--- a/service/src/main/java/org/apache/fineract/cn/rhythm/service/internal/identity/ApplicationPermissionRequestCreator.java
+++ b/service/src/main/java/org/apache/fineract/cn/rhythm/service/internal/identity/ApplicationPermissionRequestCreator.java
@@ -37,7 +37,7 @@
* @author Myrle Krantz
*/
@EndpointSet(identifier = "rhythm__v1__identity__v1")
-@FeignClient(name="identity-v1", path="/identity/v1", configuration=PermittedFeignClientsConfiguration.class)
+@FeignClient(name = "identity-service", path="/identity/v1", url = "http://${kubernetes.identity.service.name}:${kubernetes.identity.server.port}", configuration=PermittedFeignClientsConfiguration.class)
public interface ApplicationPermissionRequestCreator {
@RequestMapping(value = "/applications/{applicationidentifier}/permissions", method = RequestMethod.POST,
diff --git a/service/src/main/resources/application.yml b/service/src/main/resources/application.yml
index 9a58954..69b0b11 100644
--- a/service/src/main/resources/application.yml
+++ b/service/src/main/resources/application.yml
@@ -17,19 +17,19 @@
# under the License.
#
-spring:
- cloud:
- discovery:
- enabled: false
- config:
- enabled: false
-
-eureka:
- application:
- serviceUrl:
- defaultZone: http://localhost:8761/eureka/
- instance:
- homePageUrl: "http://${eureka.hostname}:2022/rhythm/v1/"
+#spring:
+# cloud:
+# discovery:
+# enabled: false
+# config:
+# enabled: false
+#
+#eureka:
+# application:
+# serviceUrl:
+# defaultZone: http://localhost:8761/eureka/
+# instance:
+# homePageUrl: "http://${eureka.hostname}:2022/rhythm/v1/"
server:
port: 2022
@@ -72,3 +72,19 @@
rhythm:
user: scheduler
+
+kubernetes:
+ rhythm:
+ service:
+ name: rhythm-service
+ server:
+ port: 2022
+ identity:
+ service:
+ name: identity-service
+ server:
+ port: 2021
+
+ribbon:
+ eureka:
+ enabled: false