diff --git a/receiver/build.gradle b/receiver/build.gradle index e7f48a3..a586bb2 100644 --- a/receiver/build.gradle +++ b/receiver/build.gradle @@ -4,14 +4,15 @@ dependencies { runtimeOnly 'mysql:mysql-connector-java' compileOnly 'org.projectlombok:lombok' - implementation 'org.springframework.boot:spring-boot-starter-web' + implementation project(':support') + // https://projectreactor.io/docs/core/release/reference/#debug-activate + implementation 'org.springframework.boot:spring-boot-starter-webflux' implementation 'org.telegram:telegrambots:5.3.0' annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor' annotationProcessor 'org.projectlombok:lombok' testImplementation 'org.springframework.boot:spring-boot-starter-test' - } test { diff --git a/receiver/src/main/java/com/myoa/engineering/music/soundhoundfound/receiver/infrastructure/client/ProcessorAPIWebClient.java b/receiver/src/main/java/com/myoa/engineering/music/soundhoundfound/receiver/infrastructure/client/ProcessorAPIWebClient.java new file mode 100644 index 0000000..48b9f86 --- /dev/null +++ b/receiver/src/main/java/com/myoa/engineering/music/soundhoundfound/receiver/infrastructure/client/ProcessorAPIWebClient.java @@ -0,0 +1,22 @@ +package com.myoa.engineering.music.soundhoundfound.receiver.infrastructure.client; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import org.springframework.web.reactive.function.client.WebClient; + +import java.util.List; + +@Component +public class ProcessorAPIWebClient { + + + @Value("${webclient.some}") + private String baseUrl; + + private final WebClient webClient; + + public ProcessorAPIWebClient(WebClient.Builder webClientBuilder) { + this.webClient = webClientBuilder.baseUrl("soundhoundfound-processor:20080") + .build(); + } +} \ No newline at end of file diff --git a/receiver/src/main/resources/application-development.yml b/receiver/src/main/resources/application-development.yml new file mode 100644 index 0000000..7df42f3 --- /dev/null +++ b/receiver/src/main/resources/application-development.yml @@ -0,0 +1,6 @@ +spring: + config: + activate: + on-profile: development + import: + - classpath:/development/webclient.yml \ No newline at end of file diff --git a/receiver/src/main/resources/application-production.yml b/receiver/src/main/resources/application-production.yml new file mode 100644 index 0000000..7c1069c --- /dev/null +++ b/receiver/src/main/resources/application-production.yml @@ -0,0 +1,6 @@ +spring: + config: + activate: + on-profile: production + import: + - classpath:/production/webclient.yml \ No newline at end of file diff --git a/receiver/src/main/resources/application.yml b/receiver/src/main/resources/application.yml index e69de29..2a8e30d 100644 --- a/receiver/src/main/resources/application.yml +++ b/receiver/src/main/resources/application.yml @@ -0,0 +1,10 @@ +spring: + main: + allow-bean-definition-overriding: true + profiles: + active: development + freemarker: + enabled: false + +webclient: + some: not-test \ No newline at end of file diff --git a/support/src/main/java/com/myoa/engineering/music/soundhoundfound/support/util/NumberUtil.java b/support/src/main/java/com/myoa/engineering/music/soundhoundfound/support/util/NumberUtil.java new file mode 100644 index 0000000..c4f67d1 --- /dev/null +++ b/support/src/main/java/com/myoa/engineering/music/soundhoundfound/support/util/NumberUtil.java @@ -0,0 +1,7 @@ +package com.myoa.engineering.music.soundhoundfound.support.util; + +public final class NumberUtil { + + private NumberUtil() {} + +} diff --git a/support/src/main/java/com/myoa/engineering/music/soundhoundfound/support/util/ObjectUtil.java b/support/src/main/java/com/myoa/engineering/music/soundhoundfound/support/util/ObjectUtil.java new file mode 100644 index 0000000..42d7b63 --- /dev/null +++ b/support/src/main/java/com/myoa/engineering/music/soundhoundfound/support/util/ObjectUtil.java @@ -0,0 +1,7 @@ +package com.myoa.engineering.music.soundhoundfound.support.util; + +public final class ObjectUtil { + + private ObjectUtil() {} + +} diff --git a/support/src/main/java/com/myoa/engineering/music/soundhoundfound/support/webclient/WebClientBaseScan.java b/support/src/main/java/com/myoa/engineering/music/soundhoundfound/support/webclient/WebClientBaseScan.java new file mode 100644 index 0000000..ab4e564 --- /dev/null +++ b/support/src/main/java/com/myoa/engineering/music/soundhoundfound/support/webclient/WebClientBaseScan.java @@ -0,0 +1,4 @@ +package com.myoa.engineering.music.soundhoundfound.support.webclient; + +public interface WebClientBaseScan { +} diff --git a/support/src/main/resources/development/webclient.yml b/support/src/main/resources/development/webclient.yml new file mode 100644 index 0000000..dc5e59f --- /dev/null +++ b/support/src/main/resources/development/webclient.yml @@ -0,0 +1,5 @@ +webclient: + some: test + units: + - unit-name: processor-api + base-url: http://localhost:20081 \ No newline at end of file diff --git a/support/src/main/resources/production/webclient.yml b/support/src/main/resources/production/webclient.yml new file mode 100644 index 0000000..4bb1d1d --- /dev/null +++ b/support/src/main/resources/production/webclient.yml @@ -0,0 +1,4 @@ +webclient: + units: + - unit-name: processor-api + base-url: http://soundhoundfound-processor:20080 \ No newline at end of file