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

63 setup exploration module #69

Merged
merged 53 commits into from
Aug 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
718738c
#63 - creating project, adding basic classes and placeholders
Jul 19, 2023
690280f
#63 - adding processing of data request
Jul 20, 2023
582f855
Merge remote-tracking branch 'origin/development' into 63-setup-explo…
Jul 21, 2023
9b85a9b
#63 - moving config to correct folder
Jul 21, 2023
7fb7c11
#63 - adding processing of NavRouteV1Message
Jul 21, 2023
3133a44
#63 - adding config for running the two modules alongside each other
Jul 22, 2023
c8d68a3
#63 - improving inter module communication
Jul 23, 2023
6cb012d
#63 - adding config for running the two modules alongside each other
Jul 23, 2023
339b045
#63 - fixing broken tests
Jul 23, 2023
e2d087b
Merge remote-tracking branch 'origin/45-whitelist-for-commodity' into…
Jul 25, 2023
de37817
#63 - adding controller and endpoint for allowing system search from …
Jul 25, 2023
02b85c9
#63 - adding tests
Jul 25, 2023
286e60e
#63 - fixing missing starClass
Jul 25, 2023
8742e9a
#63 - switching to postGIS
Jul 25, 2023
a28298c
Merge branch 'development' into 63-setup-exploration-module
pveeckhout Jul 25, 2023
6e1db2b
#63 - adding missing env config
Jul 26, 2023
f779cbe
#63 - refactor UseCase before service, map new services to foster reuse
Jul 26, 2023
10b03e7
#63 - code cleanup
Jul 26, 2023
222a3c8
#63 - code cleanup
Jul 26, 2023
c9f9707
#63 replacing semaphore with synchronized
pveeckhout Jul 27, 2023
9c41b19
#63 - fixing architecture issues with DDD
Jul 27, 2023
280a25c
POC - switching to pure hex based architecture
pveeckhout Aug 1, 2023
038b9e3
#63 - reworking into hex architecture
Aug 1, 2023
13ce9ff
#63 - reworking into hex architecture
Aug 1, 2023
0532dab
#63 - moving transport layer annotations to adapter package
pveeckhout Aug 2, 2023
dfc27bf
#63 - adding retry template and splitting config into files, removing…
pveeckhout Aug 2, 2023
b53071e
#63 - adding ProcessPendingSystemCoordinateRequestServiceTest
pveeckhout Aug 2, 2023
7e317ea
#63 - adding ReceiveNavRouteServiceTest
pveeckhout Aug 2, 2023
a9cb6dd
#63 - adding interface for web dto mapper
pveeckhout Aug 2, 2023
4b42770
#63 - fixing using dependencies of outer layers in application layer
pveeckhout Aug 2, 2023
d2d5d2b
#63 - fixing using dependencies of outer layers in application layer
pveeckhout Aug 2, 2023
177d239
#63 - fixing using dependencies of outer layers in application layer
pveeckhout Aug 2, 2023
234a730
#63 - adding ReceiveSystemCoordinateRequestServiceTest
Aug 2, 2023
b42bfcd
#63 - adding test
Aug 2, 2023
bba6685
#63 - adding persistence tests
Aug 2, 2023
a2f9e87
#63 - adding kafka tests
Aug 2, 2023
546b833
#63 - adding kafka tests
Aug 2, 2023
a5be69b
Merge remote-tracking branch 'origin/development' into 63-setup-explo…
Aug 2, 2023
c046bf2
#63 - record formatting
pveeckhout Aug 3, 2023
16f27fa
#63 - removing given when then, removing singleton list and organizin…
pveeckhout Aug 3, 2023
079bb86
#63 - re adding retry mechanism for consuming kafka messages
pveeckhout Aug 3, 2023
384545b
#63 - split entity and dto interfaces
Aug 4, 2023
a074cc3
#63 - rename ambiguous method name
Aug 4, 2023
02a589f
#63 - rename implementing classes to remove ambiguity
Aug 4, 2023
80419f7
#63 - adding indexes and fixing mybatis mapping issues
Aug 5, 2023
dc630b8
#63 - fixing ambiguous class name
Aug 5, 2023
8b3ae05
#63 - reverting some changes to trade module
Aug 5, 2023
7160a98
#63 - adding business validation to service
Aug 5, 2023
85f88ef
#63 - formatting
Aug 5, 2023
4034c43
#63 - disambiguate method names
Aug 5, 2023
6a3e1e1
#63 - remove unused mybatis mapper method
Aug 5, 2023
9c61e3c
#63 - refactoring method name, adding restcontroller input validation
Aug 5, 2023
0e5d873
#63 - adding swagger documentation
Aug 5, 2023
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
2 changes: 1 addition & 1 deletion boot/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ repositories {

dependencies {
implementation project(":trade-module")
implementation project(":exploration-module")
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter'
Expand All @@ -19,7 +20,6 @@ dependencies {
annotationProcessor 'org.projectlombok:lombok'



testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.edpn.backend.application.controller;

import io.edpn.backend.exploration.adapter.web.SystemController;
import io.edpn.backend.exploration.adapter.web.FindSystemsByNameContainingInputValidator;
import io.edpn.backend.exploration.application.port.incomming.FindSystemsByNameContainingUseCase;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class BootExplorationModuleController extends SystemController {

public BootExplorationModuleController(FindSystemsByNameContainingUseCase findSystemsByNameContainingUseCase, FindSystemsByNameContainingInputValidator findSystemsByNameContainingInputValidator) {
super(findSystemsByNameContainingUseCase, findSystemsByNameContainingInputValidator);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

@RestController
public class BootTradeModuleController extends DefaultTradeModuleController {

public BootTradeModuleController(FindCommodityMarketInfoService findCommodityMarketInfoService, LocateCommodityService locateCommodityService, FindCommodityService findCommodityService) {
super(findCommodityMarketInfoService, locateCommodityService, findCommodityService);
}
Expand Down
1 change: 1 addition & 0 deletions boot/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
requires edpn.backend.trade;
requires spring.web;
requires spring.beans;
requires edpn.backend.exploration;

opens io.edpn.backend.application.controller to spring.core;
}
1 change: 1 addition & 0 deletions boot/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ spring:
config:
import:
- trademodule.yaml
- explorationmodule.yaml
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ subprojects {
runtimeOnly "io.micrometer:micrometer-registry-prometheus:${prometheusVersion}"
compileOnly "org.projectlombok:lombok:${lombokVersion}"
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
testImplementation "org.springframework.boot:spring-boot-starter-test${springBootVersion}"
testImplementation "org.springframework.boot:spring-boot-starter-test:${springBootVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-params:${junitJupiterVersion}"
Expand Down
29 changes: 24 additions & 5 deletions docker-compose-localdev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,36 @@ services:
zookeeper:
condition: service_healthy

trademodule_postgres:
image: "postgres:15-alpine"
trademodule_postgis:
image: "postgis/postgis:15-3.3-alpine"
restart: on-failure
environment:
- POSTGRES_USER=edpn_trademodule
- POSTGRES_PASSWORD=MSDVq372rNk3AwRq
- POSTGRES_DB=trademodule
volumes:
- "trademodule_postgres:/var/lib/postgresql/data"
- "trademodule_postgis:/var/lib/postgresql/data"
ports:
- "54321:5432"
healthcheck:
test: pg_isready
test: ["CMD-SHELL", "pg_isready -d trademodule -U edpn_trademodule"]
interval: 10s
timeout: 5s
retries: 5

explorationmodule_postgis:
image: "postgis/postgis:15-3.3-alpine"
restart: on-failure
environment:
- POSTGRES_USER=edpn_explorationmodule
- POSTGRES_PASSWORD=TvhRZP7b6Hrw64Ct
- POSTGRES_DB=explorationmodule
volumes:
- "explorationmodule_postgis:/var/lib/postgresql/data"
ports:
- "54322:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -d explorationmodule -U edpn_explorationmodule"]
interval: 10s
timeout: 5s
retries: 5
Expand All @@ -60,5 +77,7 @@ volumes:
driver: local
kafka:
driver: local
trademodule_postgres:
trademodule_postgis:
driver: local
explorationmodule_postgis:
driver: local
30 changes: 25 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,34 @@ services:
zookeeper:
condition: service_healthy

trademodule-postgres:
## TODO: Tag this image locally
image: "postgres:15-alpine"
trademodule-postgis:
## TODO: Tag this image locally
image: "postgis/postgis:15-3.3-alpine"
restart: on-failure
env_file:
- env/${ENVIRONMENT}/.env_trademodule
volumes:
- "trademodule_postgres:/var/lib/postgresql/data"
- "trademodule_postgis:/var/lib/postgresql/data"
healthcheck:
test: ["CMD-SHELL", "pg_isready -d trademodule -U edpn_trademodule"]
interval: 10s
timeout: 5s
retries: 5

explorationmodule_postgis:
## TODO: Tag this image locally
image: "postgis/postgis:15-3.3-alpine"
restart: on-failure
env_file:
- env/${ENVIRONMENT}/.env_explorationmodule
volumes:
- "explorationmodule_postgis:/var/lib/postgresql/data"
healthcheck:
test: ["CMD-SHELL", "pg_isready -d explorationmodule -U edpn_explorationmodule"]
interval: 10s
timeout: 5s
retries: 5

eddn-message-listener:
image: nexus.edpn.io/edpn/backend/eddn-message-listener:latest-snapshot
restart: on-failure
Expand Down Expand Up @@ -80,11 +94,17 @@ services:
depends_on:
kafka:
condition: service_healthy
trademodule_postgis:
condition: service_healthy
explorationmodule_postgis:
condition: service_healthy

volumes:
zookeeper:
driver: local
kafka:
driver: local
trademodule_postgres:
trademodule_postgis:
driver: local
explorationmodule_postgis:
driver: local
47 changes: 47 additions & 0 deletions documentation/modules.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Roles
Trader(Black Market)
entities:
commodity
eddn:
commodity
fcmaterials

Builder
entities:
shipyard/outfitting
(engineering)
eddn:
shipyard
outfitting

BGSer
entities:
factions/powerplay/superpowers/thargoidwar
stations/settlement(services)
eddn:
docked
approachsettlement
location
fsdjump
carrierjump (like fsd, but with carrier station data)

Explorer
Navigation
entities:
System/bodies(composition)
station/settlement(lat/long/dist)
POI
eddn:
approachsettlement
fsdjump
carrierjump (like fsd, but with carrier station data)
location (at startup, or when being resurrected at a station)
codexentry
fssallbodiesfound (after having identified all bodies in the system)
fssbodysignals (when completing a “Full Spectrum Scan” of a starsystem)
fsssignaldiscovered (when zooming in on a signal using the FSS scanner)
navbeaconscan (number of bodies in the system)
navroute (plotted route [system name,address,pos,starclass])
saasignalfound (after using the “Surface Area Analysis” scanner)
scanbarycentre (When scanning one body of a binary pair, you will now get an event detailing the orbital parameters of their BaryCentre)
scan (basic or detailed discovery scan of a star, planet or moon)
6 changes: 6 additions & 0 deletions env/dev/.env_explorationmodule
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# .env_explorationmodule file

# PostgreSQL
POSTGRES_USER=edpn_explorationmodule
POSTGRES_PASSWORD=TvhRZP7b6Hrw64Ct
POSTGRES_DB=explorationmodule
7 changes: 6 additions & 1 deletion env/dev/.env_modulith
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
KAFKA_URL=edpn-backend-kafka-1:9092

# tradeModule
TRADEMODULE_DB_URL=jdbc:postgresql://edpn-backend-trademodule-postgres-1:5432/trademodule
TRADEMODULE_DB_URL=jdbc:postgresql://edpn-backend-trademodule-postgis-1:5432/trademodule
TRADEMODULE_DB_USERNAME=edpn_trademodule
TRADEMODULE_DB_PASSWORD=MSDVq372rNk3AwRq

# exploartionModule
EXPLORATIONMODULE_DB_URL=jdbc:postgresql://edpn-backend-explorationmodule-postgis-1:5432/explorationmodule
EXPLORATIONMODULE_DB_USERNAME=edpn_explorationmodule
EXPLORATIONMODULE_DB_PASSWORD=TvhRZP7b6Hrw64Ct
6 changes: 6 additions & 0 deletions env/local/.env_explorationmodule
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# .env_explorationmodule file

# PostgreSQL
POSTGRES_USER=edpn_explorationmodule
POSTGRES_PASSWORD=TvhRZP7b6Hrw64Ct
POSTGRES_DB=explorationmodule
40 changes: 40 additions & 0 deletions exploration-module/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
dependencies {
implementation 'io.edpn.backend:backend-util'
implementation 'io.edpn.backend:backend-mybatis-util'
implementation 'io.edpn.backend:backend-messageprocessor-lib'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-integration'
implementation 'org.springframework.integration:spring-integration-http'
implementation 'org.springframework.kafka:spring-kafka'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter'
implementation 'org.liquibase:liquibase-core'
implementation 'com.fasterxml.jackson.core:jackson-core'
implementation 'com.fasterxml.jackson.core:jackson-annotations'
implementation 'com.fasterxml.jackson.core:jackson-databind'
implementation 'io.swagger.core.v3:swagger-annotations-jakarta'

runtimeOnly 'org.postgresql:postgresql'

compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'

testImplementation 'org.junit.jupiter:junit-jupiter-api'
testImplementation 'org.junit.jupiter:junit-jupiter-engine'
testImplementation 'org.junit.jupiter:junit-jupiter-params'
testImplementation 'org.mockito:mockito-junit-jupiter'
testImplementation 'org.hamcrest:hamcrest'

testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
}

extraJavaModuleInfo {
automaticModule("kafka-clients-3.3.2.jar", "kafka.clients")
automaticModule("spring-retry-2.0.2.jar","spring.retry")
automaticModule("dependency-management-plugin-1.1.0.jar","dependency.management.plugin")
automaticModule("tomlj-1.0.0.jar","tomlj")
automaticModule("jsr305-3.0.2.jar","jsr305")
automaticModule("snappy-java-1.1.8.4.jar","snappy.java")
automaticModule("liquibase-core-4.17.2.jar","liquibase.core")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package io.edpn.backend.exploration.adapter.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

@Configuration("ExplorationAsyncConfig")
@EnableScheduling
public class AsyncConfig {

@Bean(name = "explorationTaskScheduler")
public TaskScheduler taskScheduler() {
ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
taskScheduler.setPoolSize(10); // todo Set from config
return taskScheduler;
}

@Bean(name = "explorationThreadPoolTaskExecutor")
public ThreadPoolTaskExecutor taskExecutor() {
ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
taskExecutor.setCorePoolSize(10);// todo Set from config
taskExecutor.setMaxPoolSize(50);// todo Set from config
taskExecutor.setQueueCapacity(500);// todo Set from config
taskExecutor.initialize();
return taskExecutor;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package io.edpn.backend.exploration.adapter.config;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.edpn.backend.util.IdGenerator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.retry.backoff.ExponentialBackOffPolicy;
import org.springframework.retry.policy.SimpleRetryPolicy;
import org.springframework.retry.support.RetryTemplate;

@Configuration("ExplorationModuleBeanConfig")
public class BeanConfig {

@Bean(name = "explorationIdGenerator")
public IdGenerator idGenerator() {
return new IdGenerator();
}

@Bean(name = "explorationObjectMapper")
public ObjectMapper objectMapper() {
return new ObjectMapper();
}

@Bean(name = "explorationRetryTemplate")
public RetryTemplate retryTemplate() {
RetryTemplate retryTemplate = new RetryTemplate();

SimpleRetryPolicy retryPolicy = new SimpleRetryPolicy();
retryPolicy.setMaxAttempts(5);
retryTemplate.setRetryPolicy(retryPolicy);

ExponentialBackOffPolicy backOffPolicy = new ExponentialBackOffPolicy();
backOffPolicy.setInitialInterval(1000);
backOffPolicy.setMultiplier(2.0);
backOffPolicy.setMaxInterval(30000);
retryTemplate.setBackOffPolicy(backOffPolicy);

return retryTemplate;
}
}
Loading