Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service discovery on Stream Compositions #379

Merged
merged 3 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,41 @@
# Changelog
All notable changes to this project will be documented in this file.

## [3.63.0](https://github.com/Backbase/stream-services/compare/3.62.0...3.63.0)
### Changed
- Enabling service discovery for stream composition components, direct endpoint urls were removed.
- To use static uri settings, configure it as the following example:
```yaml
backbase:
communication:
services:
stream:
legal-entity:
integration:
direct-uri: http://legal-entity-integration:8080
product:
integration:
direct-uri: http://product-integration:8080
composition:
direct-uri: http://product-composition:8080
product-catalog:
integration:
direct-uri: http://product-catalog-ingestion-integration:8080
payment-order:
integration:
direct-uri: http://payment-order-integration:8080
composition:
direct-uri: http://payment-order-composition:8080
transaction:
composition:
direct-uri: http://transaction-composition:8080
cursor:
direct-uri: http://transaction-cursor:8080
integration:
direct-uri: http://transaction-integration:8080
```
> To keep it retro-compatible you also need to set: `spring.cloud.loadbalancer.enabled=false`

## [3.62.0](https://github.com/Backbase/stream-services/compare/3.61.0...3.62.0)
### Added
- Secondary Service Agreement update
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
BB_VERSION=2023.01.9
STREAM_VERSION=3.30.1
BB_VERSION=2023.02.52-LTS
STREAM_VERSION=3.63.0
53 changes: 17 additions & 36 deletions e2e-tests/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
version: "3.9"
# https://docs.docker.com/compose/compose-file/

x-common-variables: &common-variables
JAVA_TOOL_OPTIONS: -XX:MaxRAMPercentage=60.0 -Dlogging.level.com.backbase=DEBUG
JAVA_TOOL_OPTIONS: -XX:MaxRAMPercentage=60.0
SIG_SECRET_KEY: JWTSecretKeyDontUseInProduction!
USERCTX_KEY: JWTSecretKeyDontUseInProduction!
logging.level.com.backbase: DEBUG
logging.level.org.springframework.web.filter.CommonsRequestLoggingFilter: DEBUG
server.shutdown: graceful
eureka.client.serviceUrl.defaultZone: http://registry:8080/eureka
eureka.client.healthcheck.enabled: true
eureka.client.registry-fetch-interval-seconds: 15
eureka.client.instance-info-replication-interval-seconds: 15
eureka.instance.non-secure-port: 8080
eureka.instance.initialStatus: STARTING
backbase.activemq.enabled: false
Expand All @@ -30,20 +34,19 @@ x-database-variables: &database-variables

x-healthcheck-defaults: &healthcheck-defaults
start_period: 60s
interval: 30s
interval: 15s
timeout: 5s
retries: 10
retries: 15

name: stream

services:
mysql:
container_name: stream_mysql
image: mysql:8.0.31
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: root
volumes:
- stream_mysql_data:/var/lib/mysql
- mysql_data:/var/lib/mysql
- ./mysql:/docker-entrypoint-initdb.d:rw
healthcheck:
test: mysqladmin ping --silent
Expand All @@ -52,21 +55,15 @@ services:
retries: 5

registry:
container_name: stream_registry
image: repo.backbase.com/backbase-docker-releases/registry:${BB_VERSION}
ports:
- "8761:8080"
volumes:
- ./utils/HealthCheck.java:/tmp/HealthCheck.java
healthcheck:
<<: *healthcheck-defaults
test: [ "CMD", "java", "/tmp/HealthCheck.java" ]

token-converter:
container_name: stream_token_converter
image: repo.backbase.com/backbase-docker-releases/oidc-token-converter-service:${BB_VERSION}
ports:
- "7779:8080"
environment:
<<: *common-variables
BACKBASE_OIDCTOKENCONVERTER_WHITELISTEDDOMAINS_0_INTERNALHOSTSCHEME: http
Expand All @@ -83,10 +80,7 @@ services:
- identity

identity:
container_name: stream_identity
image: repo.backbase.com/backbase-docker-releases/backbase-identity:${BB_VERSION}
ports:
- '8180:8080'
environment:
QUARKUS_DATASOURCE_URL: "jdbc:mysql://mysql:3306/backbase_identity?useSSL=false&allowPublicKeyRetrieval=true&cacheServerConfiguration=true&createDatabaseIfNotExist=true"
QUARKUS_DATASOURCE_USERNAME: "root"
Expand Down Expand Up @@ -116,13 +110,9 @@ services:
condition: service_healthy

access-control:
container_name: stream_access_control
image: repo.backbase.com/backbase-docker-releases/access-control:${BB_VERSION}
ports:
- "8040:8080"
environment:
<<: *common-variables
<<: *database-variables
<<: [*common-variables, *database-variables]
backbase.multi-tenancy.datasource.default-catalog: t1_access_control
backbase.multi-tenancy.tenants[0].catalog: t1_access_control
backbase.multi-tenancy.tenants[1].catalog: t2_access_control
Expand All @@ -138,13 +128,9 @@ services:
- registry

user-manager:
container_name: stream_user_manager
image: repo.backbase.com/backbase-docker-releases/user-manager:${BB_VERSION}
ports:
- "8060:8080"
environment:
<<: *common-variables
<<: *database-variables
<<: [*common-variables, *database-variables]
backbase.multi-tenancy.datasource.default-catalog: t1_user_manager
backbase.multi-tenancy.tenants[0].catalog: t1_user_manager
backbase.multi-tenancy.tenants[1].catalog: t2_user_manager
Expand All @@ -163,10 +149,7 @@ services:
- registry

identity-integration-service:
container_name: stream_identity_integration_service
image: repo.backbase.com/backbase-docker-releases/identity-integration-service:${BB_VERSION}
ports:
- "8070:8080"
environment:
<<: *common-variables
IDENTITY_SERVERURL: http://identity:8080/auth
Expand All @@ -183,7 +166,6 @@ services:
- registry

legal-entity-bootstrap-task:
container_name: stream_legal_entity_bootstrap_task
image: repo.backbase.com/backbase-stream-images/legal-entity-bootstrap-task:${STREAM_VERSION}
environment:
<<: *common-variables
Expand All @@ -202,11 +184,10 @@ services:
identity:
condition: service_healthy

legal-entity-composition-service:
container_name: stream_legal_entity_composition
legal-entity-composition:
image: repo.backbase.com/backbase-stream-images/legal-entity-composition-service:${STREAM_VERSION}
ports:
- "8050:8080"
- "8989:8080"
environment:
<<: *common-variables
bootstrap.enabled: true
Expand All @@ -215,7 +196,7 @@ services:
- ./utils/HealthCheck.java:/tmp/HealthCheck.java
healthcheck:
<<: *healthcheck-defaults
test: [ "CMD", "java", "/tmp/HealthCheck.java", "http://localhost:8080/actuator/health" ]
test: [ "CMD", "java", "/tmp/HealthCheck.java", "http://registry:8080/eureka/apps/legal-entity-composition" ]
depends_on:
token-converter:
condition: service_healthy
Expand All @@ -229,7 +210,7 @@ services:
condition: service_healthy

volumes:
stream_mysql_data:
mysql_data:
driver: local

networks:
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.buildingblocks</groupId>
<artifactId>backbase-parent</artifactId>
<version>15.2.2</version>
<version>15.2.3</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -38,7 +38,7 @@

<properties>
<java.version>17</java.version>
<ssdk.version>15.2.2</ssdk.version>
<ssdk.version>15.2.3</ssdk.version>
<backbase-bom.version>2023.06.2</backbase-bom.version>
<boat-maven-plugin.version>0.16.6</boat-maven-plugin.version>
<spring-boot.repackage.skip>true</spring-boot.repackage.skip>
Expand Down
12 changes: 12 additions & 0 deletions stream-compositions/cursors/transaction-cursor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>com.backbase.buildingblocks</groupId>
<artifactId>service-sdk-starter-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-kubernetes-fabric8</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-kubernetes-fabric8-loadbalancer</artifactId>
</dependency>
<dependency>
<groupId>com.backbase.stream.compositions.api</groupId>
<artifactId>transaction-cursor-api</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions stream-compositions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.backbase.buildingblocks</groupId>
<artifactId>service-sdk-starter-reactive</artifactId>
<version>15.2.2</version>
<version>15.2.3</version>
<relativePath/>
</parent>

Expand All @@ -23,7 +23,7 @@
<skip.integration.tests>false</skip.integration.tests>
<sonar.test.exclusions>**/test/**/*</sonar.test.exclusions>
<spring-cloud-kubernetes.version>2.1.3</spring-cloud-kubernetes.version>
<ssdk.version>15.2.2</ssdk.version>
<ssdk.version>15.2.3</ssdk.version>
<jib.container.volumes>/tmp</jib.container.volumes>
</properties>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,70 +1,17 @@
package com.backbase.stream.compositions.legalentity.core.config;

import com.backbase.buildingblocks.webclient.WebClientConstants;
import com.backbase.stream.compositions.legalentity.integration.client.LegalEntityIntegrationApi;
import com.backbase.stream.compositions.product.ApiClient;
import com.backbase.stream.compositions.product.client.ProductCompositionApi;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.http.MediaType;
import org.springframework.security.config.web.server.ServerHttpSecurity;
import org.springframework.security.web.server.SecurityWebFilterChain;
import org.springframework.web.reactive.function.client.WebClient;

import java.text.DateFormat;

@Configuration
@AllArgsConstructor
@EnableConfigurationProperties({
LegalEntityConfigurationProperties.class
})
@EnableConfigurationProperties(LegalEntityConfigurationProperties.class)
public class LegalEntityConfiguration {

private final LegalEntityConfigurationProperties legalEntityConfigurationProperties;

@Bean
@Primary
public LegalEntityIntegrationApi legalEntityIntegrationApi(
com.backbase.stream.compositions.legalentity.integration.ApiClient legalEntityClient) {
return new LegalEntityIntegrationApi(legalEntityClient);
}

@Bean
@Primary
public ProductCompositionApi productCompositionApi(ApiClient productClient) {
return new ProductCompositionApi(productClient);
}

@Bean
public ApiClient productClient(
@Qualifier(WebClientConstants.INTER_SERVICE_WEB_CLIENT_NAME) WebClient dbsWebClient,
ObjectMapper objectMapper,
DateFormat dateFormat) {
ApiClient apiClient = new ApiClient(dbsWebClient, objectMapper, dateFormat);
apiClient.setBasePath(
legalEntityConfigurationProperties.getChains().getProductComposition().getBaseUrl());

return apiClient;
}

@Bean
public com.backbase.stream.compositions.legalentity.integration.ApiClient legalEntityClient(
@Qualifier(WebClientConstants.INTER_SERVICE_WEB_CLIENT_NAME) WebClient dbsWebClient,
ObjectMapper objectMapper,
DateFormat dateFormat) {
com.backbase.stream.compositions.legalentity.integration.ApiClient apiClient =
new com.backbase.stream.compositions.legalentity.integration.ApiClient(
dbsWebClient, objectMapper, dateFormat);
apiClient.setBasePath(legalEntityConfigurationProperties.getIntegrationBaseUrl());

return apiClient;
}

@Bean
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
return http.csrf().disable().build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
@ConfigurationProperties("backbase.stream.compositions.legal-entity")
public class LegalEntityConfigurationProperties {

private String integrationBaseUrl = "http://legal-entity-integration:9000";
private Chains chains = new Chains();
private Events events = new Events();
private Cursor cursor = new Cursor();
Expand All @@ -22,28 +21,30 @@ public class LegalEntityConfigurationProperties {
@Data
@NoArgsConstructor
public static class Events {

private Boolean enableCompleted = Boolean.FALSE;
private Boolean enableFailed = Boolean.FALSE;
}

@Data
@NoArgsConstructor
public static class Cursor {

private Boolean enabled = Boolean.FALSE;
private String baseUrl = "http://legal-entity-cursor:9000";
}

@Data
@NoArgsConstructor
public static class Chains {

private Boolean includeSubsidiaries = Boolean.FALSE;
private ProductComposition productComposition = new ProductComposition();
}

@Data
public static abstract class BaseComposition {

private Boolean enabled = Boolean.FALSE;
private String baseUrl = "http://localhost:9002/";
private Boolean async = Boolean.FALSE;
}

Expand All @@ -55,6 +56,7 @@ public static class ProductComposition extends BaseComposition {
@Data
@NoArgsConstructor
public static class IngestionMode {

private BatchProductIngestionMode.FunctionGroupsMode functionGroups = BatchProductIngestionMode.FunctionGroupsMode.UPSERT;
private BatchProductIngestionMode.DataGroupsMode dataGroups = BatchProductIngestionMode.DataGroupsMode.UPSERT;
private BatchProductIngestionMode.ArrangementsMode arrangements = BatchProductIngestionMode.ArrangementsMode.UPSERT;
Expand All @@ -78,9 +80,9 @@ public boolean isProductChainAsync() {

public BatchProductIngestionMode ingestionMode() {
return BatchProductIngestionMode.builder()
.functionGroupsMode(ingestionMode.getFunctionGroups())
.dataGroupIngestionMode(ingestionMode.getDataGroups())
.arrangementsMode(ingestionMode.getArrangements())
.build();
.functionGroupsMode(ingestionMode.getFunctionGroups())
.dataGroupIngestionMode(ingestionMode.getDataGroups())
.arrangementsMode(ingestionMode.getArrangements())
.build();
}
}
Loading
Loading