From 7b015e8093ac9cf61aafd21ea3a0196214dc10d4 Mon Sep 17 00:00:00 2001 From: woozu-shin Date: Thu, 9 May 2024 08:49:11 +0900 Subject: [PATCH] [NO-ISSUE] Remove reader, processor, writer --- processor/build.gradle | 31 - .../processor/ProcessorApplication.java | 23 - .../controller/CrawlAPIController.java | 55 - .../parser/PpomppuArticleParser.java | 79 -- .../resources/application-development.yml | 12 - .../src/main/resources/application-local.yml | 11 - .../main/resources/application-production.yml | 6 - processor/src/main/resources/application.yml | 25 - .../src/main/resources/logback-spring.xml | 15 - .../logback/component/logback-file.xml | 23 - .../resources/logback/logback-development.xml | 19 - .../resources/logback/logback-production.xml | 19 - .../test/resources/logback-development.xml | 12 - .../src/test/resources/logback-spring.xml | 6 - .../test/resources/testdata/zboard/file1.html | 1100 ----------------- reader/build.gradle | 26 - .../ppomppu/reader/ReaderApplication.java | 23 - .../TelegramBotConfiguration.java | 39 - .../properties/TelegramBotProperties.java | 41 - .../controller/v1/EventAPIController.java | 33 - .../reader/dispatch/MessageDispatcher.java | 50 - .../message/HelloWorldMessageHandler.java | 21 - .../handler/message/ImageMessageHandler.java | 12 - .../handler/message/MessageHandler.java | 17 - .../handler/message/TextMessageHandler.java | 18 - .../handler/message/text/CommandHandler.java | 48 - .../message/text/CommonTextHandler.java | 30 - .../text/EmptyTextCommandProcessor.java | 24 - .../text/StartTextCommandProcessor.java | 27 - .../handler/message/text/TextCommandCode.java | 33 - .../message/text/TextCommandProcessor.java | 17 - .../client/ProcessorAPIWebClient.java | 44 - .../reader/scheduler/ParseEventEmitter.java | 36 - .../reader/service/ProcessorAPIService.java | 30 - .../resources/application-development.yml | 6 - .../src/main/resources/application-local.yml | 6 - .../main/resources/application-production.yml | 7 - reader/src/main/resources/application.yml | 25 - reader/src/main/resources/logback-spring.xml | 15 - .../logback/component/logback-file.xml | 23 - .../resources/logback/logback-development.xml | 19 - .../resources/logback/logback-production.xml | 19 - writer/build.gradle | 23 - .../MessageSenderAPIController.java | 35 - .../writer/controller/TestAPIController.java | 33 - .../resources/application-development.yml | 10 - .../src/main/resources/application-local.yml | 10 - .../main/resources/application-production.yml | 6 - writer/src/main/resources/application.yml | 25 - writer/src/main/resources/logback-spring.xml | 15 - .../logback/component/logback-file.xml | 23 - .../resources/logback/logback-development.xml | 19 - .../resources/logback/logback-production.xml | 19 - 53 files changed, 2343 deletions(-) delete mode 100644 processor/build.gradle delete mode 100644 processor/src/main/java/com/myoa/engineering/crawl/ppomppu/processor/ProcessorApplication.java delete mode 100644 processor/src/main/java/com/myoa/engineering/crawl/ppomppu/processor/controller/CrawlAPIController.java delete mode 100644 processor/src/main/java/com/myoa/engineering/crawl/ppomppu/processor/parser/PpomppuArticleParser.java delete mode 100644 processor/src/main/resources/application-development.yml delete mode 100644 processor/src/main/resources/application-local.yml delete mode 100644 processor/src/main/resources/application-production.yml delete mode 100644 processor/src/main/resources/application.yml delete mode 100644 processor/src/main/resources/logback-spring.xml delete mode 100644 processor/src/main/resources/logback/component/logback-file.xml delete mode 100644 processor/src/main/resources/logback/logback-development.xml delete mode 100644 processor/src/main/resources/logback/logback-production.xml delete mode 100644 processor/src/test/resources/logback-development.xml delete mode 100644 processor/src/test/resources/logback-spring.xml delete mode 100644 processor/src/test/resources/testdata/zboard/file1.html delete mode 100644 reader/build.gradle delete mode 100644 reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/ReaderApplication.java delete mode 100644 reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/configuration/TelegramBotConfiguration.java delete mode 100644 reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/configuration/properties/TelegramBotProperties.java delete mode 100644 reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/controller/v1/EventAPIController.java delete mode 100644 reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/dispatch/MessageDispatcher.java delete mode 100644 reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/HelloWorldMessageHandler.java delete mode 100644 reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/ImageMessageHandler.java delete mode 100644 reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/MessageHandler.java delete mode 100644 reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/TextMessageHandler.java delete mode 100644 reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/text/CommandHandler.java delete mode 100644 reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/text/CommonTextHandler.java delete mode 100644 reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/text/EmptyTextCommandProcessor.java delete mode 100644 reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/text/StartTextCommandProcessor.java delete mode 100644 reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/text/TextCommandCode.java delete mode 100644 reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/text/TextCommandProcessor.java delete mode 100644 reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/infrastructure/client/ProcessorAPIWebClient.java delete mode 100644 reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/scheduler/ParseEventEmitter.java delete mode 100644 reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/service/ProcessorAPIService.java delete mode 100644 reader/src/main/resources/application-development.yml delete mode 100644 reader/src/main/resources/application-local.yml delete mode 100644 reader/src/main/resources/application-production.yml delete mode 100644 reader/src/main/resources/application.yml delete mode 100644 reader/src/main/resources/logback-spring.xml delete mode 100644 reader/src/main/resources/logback/component/logback-file.xml delete mode 100644 reader/src/main/resources/logback/logback-development.xml delete mode 100644 reader/src/main/resources/logback/logback-production.xml delete mode 100644 writer/build.gradle delete mode 100644 writer/src/main/java/com/myoa/engineering/crawl/ppomppu/writer/controller/MessageSenderAPIController.java delete mode 100644 writer/src/main/java/com/myoa/engineering/crawl/ppomppu/writer/controller/TestAPIController.java delete mode 100644 writer/src/main/resources/application-development.yml delete mode 100644 writer/src/main/resources/application-local.yml delete mode 100644 writer/src/main/resources/application-production.yml delete mode 100644 writer/src/main/resources/application.yml delete mode 100644 writer/src/main/resources/logback-spring.xml delete mode 100644 writer/src/main/resources/logback/component/logback-file.xml delete mode 100644 writer/src/main/resources/logback/logback-development.xml delete mode 100644 writer/src/main/resources/logback/logback-production.xml diff --git a/processor/build.gradle b/processor/build.gradle deleted file mode 100644 index dee2708..0000000 --- a/processor/build.gradle +++ /dev/null @@ -1,31 +0,0 @@ - -dependencies { - developmentOnly 'org.springframework.boot:spring-boot-devtools' - runtimeOnly 'com.h2database:h2' - runtimeOnly 'mysql:mysql-connector-java' - compileOnly 'org.projectlombok:lombok' - - implementation project(':support') - // https://projectreactor.io/docs/core/release/reference/#debug-activate - implementation 'org.springframework.boot:spring-boot-starter-webflux' - implementation 'org.springframework.boot:spring-boot-starter-data-jpa' - implementation 'org.springframework.boot:spring-boot-starter-jdbc' - implementation 'org.springframework.cloud:spring-cloud-starter-config' - implementation 'org.springframework.boot:spring-boot-starter-actuator' - implementation 'com.rometools:rome:2.1.0' - implementation 'org.jsoup:jsoup:1.15.3' - implementation 'com.h2database:h2:2.2.220' - - annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor' - annotationProcessor 'org.projectlombok:lombok' - - testImplementation 'org.springframework.boot:spring-boot-starter-test' - testImplementation("org.assertj:assertj-core:3.24.2") -} - -test { - useJUnitPlatform() - testLogging { - events "passed", "skipped", "failed" - } -} \ No newline at end of file diff --git a/processor/src/main/java/com/myoa/engineering/crawl/ppomppu/processor/ProcessorApplication.java b/processor/src/main/java/com/myoa/engineering/crawl/ppomppu/processor/ProcessorApplication.java deleted file mode 100644 index c47a0d2..0000000 --- a/processor/src/main/java/com/myoa/engineering/crawl/ppomppu/processor/ProcessorApplication.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.myoa.engineering.crawl.ppomppu.processor; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Import; - -import com.myoa.engineering.crawl.shopping.support.webclient.PpomppuNotifierWebClientConfiguration; - -/** - * ProcessorApplication - * @author Shin Woo-jin (woo-jin.shin@linecorp.com) - * @since 2021-08-20 - * - */ -@Import({ PpomppuNotifierWebClientConfiguration.class }) -@SpringBootApplication -public class ProcessorApplication { - - public static void main(String[] args) { - SpringApplication.run(ProcessorApplication.class, args); - } - -} diff --git a/processor/src/main/java/com/myoa/engineering/crawl/ppomppu/processor/controller/CrawlAPIController.java b/processor/src/main/java/com/myoa/engineering/crawl/ppomppu/processor/controller/CrawlAPIController.java deleted file mode 100644 index e7428a1..0000000 --- a/processor/src/main/java/com/myoa/engineering/crawl/ppomppu/processor/controller/CrawlAPIController.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.myoa.engineering.crawl.ppomppu.processor.controller; - -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import com.myoa.engineering.crawl.ppomppu.processor.dto.FeedParsedResult; -import com.myoa.engineering.crawl.ppomppu.processor.service.MessageSenderService; -import com.myoa.engineering.crawl.ppomppu.processor.service.PpomppuArticleService; -import com.myoa.engineering.crawl.ppomppu.processor.service.PpomppuFeedService; -import com.myoa.engineering.crawl.shopping.support.dto.APIResponse; -import com.myoa.engineering.crawl.shopping.support.dto.constant.PpomppuBoardName; - -import lombok.extern.slf4j.Slf4j; -import reactor.core.publisher.Mono; - -/** - * CrawlAPIController - * - * @author Shin Woo-jin (woo-jin.shin@linecorp.com) - * @since 2021-09-05 - */ -@Slf4j -@RestController -@RequestMapping("/api/v1/crawl") -public class CrawlAPIController { - - private final PpomppuFeedService ppomppuRSSFeedService; - private final PpomppuArticleService ppomppuArticleService; - private final MessageSenderService messageSenderService; - - public CrawlAPIController(PpomppuFeedService ppomppuRSSFeedService, - PpomppuArticleService ppomppuArticleService, - MessageSenderService messageSenderService) { - this.ppomppuRSSFeedService = ppomppuRSSFeedService; - this.ppomppuArticleService = ppomppuArticleService; - this.messageSenderService = messageSenderService; - } - - @PostMapping("/boards/{boardName}") - public Mono> crawlBoard(@PathVariable("boardName") PpomppuBoardName boardName) { - log.info("got request... {}", boardName); - FeedParsedResult result = FeedParsedResult.of(boardName); - - Mono publishedMessages = - ppomppuRSSFeedService.getArticles(boardName) - .map(e -> ppomppuArticleService.filterOnlyNewArticles(boardName, e)) - .map(e -> ppomppuArticleService.save(boardName, e)) - .flatMap(messageSenderService::sendMessageToSlack); - - return publishedMessages.then(Mono.just(APIResponse.success(result.done()))); - } - -} diff --git a/processor/src/main/java/com/myoa/engineering/crawl/ppomppu/processor/parser/PpomppuArticleParser.java b/processor/src/main/java/com/myoa/engineering/crawl/ppomppu/processor/parser/PpomppuArticleParser.java deleted file mode 100644 index 58e7b25..0000000 --- a/processor/src/main/java/com/myoa/engineering/crawl/ppomppu/processor/parser/PpomppuArticleParser.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.myoa.engineering.crawl.ppomppu.processor.parser; - -import java.time.Instant; -import java.time.ZoneId; -import java.time.format.DateTimeFormatter; - -import org.jsoup.nodes.Element; -import org.jsoup.select.Elements; - -import com.myoa.engineering.crawl.ppomppu.processor.domain.PpomppuArticle; -import com.myoa.engineering.crawl.shopping.support.dto.constant.PpomppuBoardName; - -/** - * PpomppuArticleTransformer - * - * @author Shin Woo-jin (woozu.shin@kakaoent.com) - * @since 2021-09-08 - */ -public final class PpomppuArticleParser { - - private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yy.MM.dd HH:mm:ss") - .withZone(ZoneId.of("Asia/Seoul")); - - private PpomppuArticleParser() {} - - public static PpomppuArticle toArticle(Elements articleElement) { - final long articleId = PpomppuArticleParser.parseArticleId(articleElement.get(0)); - final String title = PpomppuArticleParser.parseTitle(articleElement.get(2)); - final String articleUrl = PpomppuArticleParser.parseArticleUrl(articleElement.get(2)); - final int recommended = PpomppuArticleParser.parseRecommended(articleElement.get(6)); - final int hit = PpomppuArticleParser.parseHit(articleElement.get(7)); - final Instant registeredAt = PpomppuArticleParser.parseRegisteredAt(articleElement.get(5)); - - return PpomppuArticle.builder() - .articleId(articleId) - .title(title) - .articleUrl(articleUrl) - .recommended(recommended) - .hit(hit) - .registeredAt(registeredAt) - .build(); - } - - public static Long parseArticleId(Element td) { - return Long.parseLong(td.text().trim()); - } - - public static String parseTitle(Element td) { - return td.getElementsByTag("a").text(); // TODO cdn image extracting - } - - public static String parseArticleUrl(Element td) { - return PpomppuBoardName.ofViewPageUrl(td.getElementsByTag("a").attr("href")); - } - - public static Integer parseRecommended(Element td) { - final String voteString = td.text(); - final int recommended; - - if (voteString.isEmpty()) { - recommended = 0; - } else { - final int voteUp = Integer.parseInt(td.text().split(" - ")[0]); - final int voteDown = Integer.parseInt(td.text().split(" - ")[1]); - recommended = voteUp - voteDown; - } - return recommended; - } - - public static Integer parseHit(Element td) { - return Integer.parseInt(td.text()); - } - - public static Instant parseRegisteredAt(Element td) { - final String registeredAtString = td.attr("title"); - return DATE_TIME_FORMATTER.parse(registeredAtString, Instant::from); - } - -} diff --git a/processor/src/main/resources/application-development.yml b/processor/src/main/resources/application-development.yml deleted file mode 100644 index 55a446f..0000000 --- a/processor/src/main/resources/application-development.yml +++ /dev/null @@ -1,12 +0,0 @@ -spring: - config: - activate: - on-profile: development - import: - - "configserver:http://192.168.0.100:20085" - - -server: - port: 20081 - - # import: optional:configserver:http://localhost:11080 # can be start up even config server was not found. \ No newline at end of file diff --git a/processor/src/main/resources/application-local.yml b/processor/src/main/resources/application-local.yml deleted file mode 100644 index 42ba0a4..0000000 --- a/processor/src/main/resources/application-local.yml +++ /dev/null @@ -1,11 +0,0 @@ -spring: - config: - activate: - on-profile: local - import: - - "configserver:http://localhost:20085" - -server: - port: 20081 - - # import: optional:configserver:http://localhost:11080 # can be start up even config server was not found. \ No newline at end of file diff --git a/processor/src/main/resources/application-production.yml b/processor/src/main/resources/application-production.yml deleted file mode 100644 index 4ff32ed..0000000 --- a/processor/src/main/resources/application-production.yml +++ /dev/null @@ -1,6 +0,0 @@ -spring: - config: - activate: - on-profile: production - import: - - "configserver:http://ppn-config-server:20080" diff --git a/processor/src/main/resources/application.yml b/processor/src/main/resources/application.yml deleted file mode 100644 index c361985..0000000 --- a/processor/src/main/resources/application.yml +++ /dev/null @@ -1,25 +0,0 @@ -spring: - application: - name: ppn-processor - main: - allow-bean-definition-overriding: true - profiles: - active: ${SPRING_ACTIVE_PROFILE:local} - group: - local: "local,datasource-local,webclient-local" - development: "development,datasource-development,webclient-development" - production: "production, datasource-production,webclient-production" - freemarker: - enabled: false - -server: - port: 20080 - error: - whitelabel: - enabled: false - -management: - endpoints: - web: - exposure: - include: refresh diff --git a/processor/src/main/resources/logback-spring.xml b/processor/src/main/resources/logback-spring.xml deleted file mode 100644 index 907a4f5..0000000 --- a/processor/src/main/resources/logback-spring.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/processor/src/main/resources/logback/component/logback-file.xml b/processor/src/main/resources/logback/component/logback-file.xml deleted file mode 100644 index 65e54db..0000000 --- a/processor/src/main/resources/logback/component/logback-file.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - ${DIRECTORY}/${LOG_FILE_BASE}_log - - ${DIRECTORY}/${LOG_FILE_BASE}_log.%d{yyyyMMdd}.%i - - 1000MB - - 60 - - - ${FILE_LOG_PATTERN} - ${IMMEDIATE_FLUSH} - - - - 1024 - - - diff --git a/processor/src/main/resources/logback/logback-development.xml b/processor/src/main/resources/logback/logback-development.xml deleted file mode 100644 index 458e3d8..0000000 --- a/processor/src/main/resources/logback/logback-development.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/processor/src/main/resources/logback/logback-production.xml b/processor/src/main/resources/logback/logback-production.xml deleted file mode 100644 index f824e41..0000000 --- a/processor/src/main/resources/logback/logback-production.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/processor/src/test/resources/logback-development.xml b/processor/src/test/resources/logback-development.xml deleted file mode 100644 index ab50ad9..0000000 --- a/processor/src/test/resources/logback-development.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/processor/src/test/resources/logback-spring.xml b/processor/src/test/resources/logback-spring.xml deleted file mode 100644 index 04ccbd8..0000000 --- a/processor/src/test/resources/logback-spring.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/processor/src/test/resources/testdata/zboard/file1.html b/processor/src/test/resources/testdata/zboard/file1.html deleted file mode 100644 index b9268d3..0000000 --- a/processor/src/test/resources/testdata/zboard/file1.html +++ /dev/null @@ -1,1100 +0,0 @@ - - - - - - - - - - - - - - - - 뽐뿌 - 뽐뿌게시판 - - - - - - - - - - - - - - - - - - - - -
- -
-
 
-
-
-
- 뽐뿌 - 뽐뿌 -
- -
-
-
-
- - -
- -
- - - -
- -
- -
-
- 가성비 좋은 상품과 쇼핑정보를 공유하는 공간입니다. [뽐뿌게시판 이용규칙] -
- - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   번호     글쓴이  제목 등록일 추천    조회   
공지관리자3[필독] 제목에는 특수 문자 사용을 절대 금지합니다.- 2010년 2월 24일0 4324677
알림관리자아이콘알리익스프레스 상품은 [알리뽐뿌]에 공유해 주세요!
알림관리자아이콘[키워드 알림] 관심 키워드 등록하고, 앱push 알림 받자!
537951매력적인뽐뿌 - - 1069
537950123aaa - - 1508
537949유유자적루 - - 1201
537947illilliiill - - 9 - 0 14917
5379461회제공량 - - 9522
537945가을말차라떼 - - 1 - 0 17666
537944거북반 - - 13039
537942jimin1120 - - 2 - 0 5767
537941너구리사랑 - - 16 - 0 10050
537940깡패건달 - - 4 - 0 7273
537939심의켄 - - 8 - 0 7724
537938벌꿀오소리는강해 - - 5892
537937매카aa - - 5186
537936나무007 - - 15 - 0 13237
537935IilliillIi - - 3597
537934최군어뭉 - - 6 - 0 6264
537933무념무상해 - - 1 - 0 6198
537931p1ano - - 3 - 0 6065
537930킹갓제네럴MZ - - 1 - 0 16634
537929꿉지 - - 1 - 0 5952
쇼핑뽐뿌 아이콘아스라슬 - - - 56 - 05325
쇼핑뽐뿌 아이콘LG전자쿠팡공식대행... - - - 57 - 03128
-
-

- 쇼핑포럼뽐뿌상담실 아이콘더 많은 쇼핑 정보와 구매 전 자유로운 쇼핑 이야기는 쇼핑포럼에서! -

-
-
핫딜 아이콘 - 쿠팡 - - - - 7
쇼핑포럼 아이콘 - ll427ll - - - - 907
쇼핑포럼 아이콘 - HBAF - - -
- - [식품/건강]
-
1 - 010894
쇼핑포럼 아이콘 - 시뻘건맛 - - - - 10935
-
-
- -
-
-
-
-
-
- - - - -
- -
-
-

- 실시간 질렀어요 -
    -
  1. 1
  2. 2
-

- -
    -
  • -
  • -
  • -
  • -
-
- -
-

- 최근 내가 본 상품 -
    -
-

-
    -
  • 최근 내가 본 상품이 없습니다.
-
-
- - - - - - -
- -  -새로고침  -다음페이지   -
- - - - - - - -
- - 1 2 3 4 5 6 7 8 9 10 다음 -
- - - - - - - - - - - - -
- - - - - -
- - - - - - - - - -
-
- - - - -
- -
- - -
- - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - diff --git a/reader/build.gradle b/reader/build.gradle deleted file mode 100644 index d256b7c..0000000 --- a/reader/build.gradle +++ /dev/null @@ -1,26 +0,0 @@ -dependencies { - developmentOnly 'org.springframework.boot:spring-boot-devtools' - runtimeOnly 'com.h2database:h2' - runtimeOnly 'mysql:mysql-connector-java' - compileOnly 'org.projectlombok:lombok' - - implementation project(':support') - // https://projectreactor.io/docs/core/release/reference/#debug-activate - implementation 'org.springframework.boot:spring-boot-starter-webflux' - implementation 'org.springframework.boot:spring-boot-configuration-processor' - implementation 'org.springframework.cloud:spring-cloud-starter-config' - implementation 'org.springframework.boot:spring-boot-starter-actuator' - 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 { - useJUnitPlatform() - testLogging { - events "passed", "skipped", "failed" - } -} \ No newline at end of file diff --git a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/ReaderApplication.java b/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/ReaderApplication.java deleted file mode 100644 index b50e587..0000000 --- a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/ReaderApplication.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.myoa.engineering.crawl.ppomppu.reader; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Import; - -import com.myoa.engineering.crawl.shopping.support.webclient.PpomppuNotifierWebClientConfiguration; - -/** - * ReceiverApplication - * @author Shin Woo-jin (woo-jin.shin@linecorp.com) - * @since 2021-08-20 - * - */ -@Import({ PpomppuNotifierWebClientConfiguration.class}) -@SpringBootApplication -// @EnableConfigurationProperties({ TelegramBotProperties.class }) -public class ReaderApplication { - - public static void main(String[] args) { - SpringApplication.run(ReaderApplication.class, args); - } -} diff --git a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/configuration/TelegramBotConfiguration.java b/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/configuration/TelegramBotConfiguration.java deleted file mode 100644 index 2370c11..0000000 --- a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/configuration/TelegramBotConfiguration.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.myoa.engineering.crawl.ppomppu.reader.configuration; - -import java.util.List; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.telegram.telegrambots.meta.TelegramBotsApi; -import org.telegram.telegrambots.meta.exceptions.TelegramApiException; -import org.telegram.telegrambots.updatesreceivers.DefaultBotSession; - -import com.myoa.engineering.crawl.ppomppu.reader.configuration.properties.TelegramBotProperties; -import com.myoa.engineering.crawl.ppomppu.reader.configuration.properties.TelegramBotProperties.TelegramBotPropertiesUnit; -import com.myoa.engineering.crawl.ppomppu.reader.dispatch.MessageDispatcher; -import com.myoa.engineering.crawl.ppomppu.reader.handler.message.MessageHandler; - -/** - * TelegramBotConfiguration - * @author Shin Woo-jin (woo-jin.shin@linecorp.com) - * @since 2021-08-21 - * - */ -@Configuration -public class TelegramBotConfiguration { - - private static final String BOT_PROPERTIES_UNIT_NAME = "ppomppu_notify_bot"; - @Bean - public TelegramBotsApi telegramBotsApi(MessageDispatcher messageDispatcher) throws TelegramApiException { - TelegramBotsApi api = new TelegramBotsApi(DefaultBotSession.class); - api.registerBot(messageDispatcher); - return api; - } - - @Bean - public MessageDispatcher messageDispatcher(List messageHandlers, - TelegramBotProperties telegramBotProperties) { - TelegramBotPropertiesUnit propertiesUnit = telegramBotProperties.find(BOT_PROPERTIES_UNIT_NAME); - return new MessageDispatcher(messageHandlers, propertiesUnit.getName(), propertiesUnit.getToken()); - } -} diff --git a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/configuration/properties/TelegramBotProperties.java b/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/configuration/properties/TelegramBotProperties.java deleted file mode 100644 index 04113aa..0000000 --- a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/configuration/properties/TelegramBotProperties.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.myoa.engineering.crawl.ppomppu.reader.configuration.properties; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; - -import lombok.Data; -import lombok.Getter; -import lombok.Setter; - -/** - * TelegramBotProperties - * @author Shin Woo-jin (woo-jin.shin@linecorp.com) - * @since 2021-09-05 - * - */ -@Component -@Setter -@Getter -@ConfigurationProperties(prefix = "infra.telegram.bot") -public class TelegramBotProperties { - - private List units = new ArrayList<>(); - - @Data - public static class TelegramBotPropertiesUnit { - private String unitName; - private String name; - private String token; - } - - public TelegramBotPropertiesUnit find(String unitName) { - return units.stream() - .filter(e -> e.getUnitName().equals(unitName)) - .findFirst() - .orElseThrow( - () -> new IllegalArgumentException(this.getClass().getName() + ": unitName Not found. " + unitName)); - } -} diff --git a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/controller/v1/EventAPIController.java b/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/controller/v1/EventAPIController.java deleted file mode 100644 index c071d8c..0000000 --- a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/controller/v1/EventAPIController.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.myoa.engineering.crawl.ppomppu.reader.controller.v1; - -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import com.myoa.engineering.crawl.ppomppu.reader.service.ProcessorAPIService; -import com.myoa.engineering.crawl.shopping.support.dto.constant.PpomppuBoardName; - -import reactor.core.publisher.Mono; - -/** - * EventAPIController - * @author Shin Woo-jin (woo-jin.shin@linecorp.com) - * @since 2021-09-05 - * - */ -@RestController -@RequestMapping("/api/v1/") -public class EventAPIController { - - private final ProcessorAPIService processorAPIService; - - public EventAPIController(ProcessorAPIService processorAPIService) { - this.processorAPIService = processorAPIService; - } - - @PostMapping("/exploit/parsePpomppuRSS/{boardName}") - public Mono parsePpomppuRSS(@PathVariable("boardName") PpomppuBoardName boardName) { - return processorAPIService.emitParseEvent(boardName); - } -} diff --git a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/dispatch/MessageDispatcher.java b/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/dispatch/MessageDispatcher.java deleted file mode 100644 index 3c20384..0000000 --- a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/dispatch/MessageDispatcher.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.myoa.engineering.crawl.ppomppu.reader.dispatch; - -import java.util.List; - -import org.telegram.telegrambots.bots.TelegramLongPollingBot; -import org.telegram.telegrambots.meta.api.objects.Message; -import org.telegram.telegrambots.meta.api.objects.Update; - -import com.myoa.engineering.crawl.ppomppu.reader.handler.message.MessageHandler; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -public class MessageDispatcher extends TelegramLongPollingBot { - - private final List messageHandlers; - private final String botName; - private final String botToken; - - public MessageDispatcher(List messageHandlers, String botName, String botToken) { - this.messageHandlers = messageHandlers; - this.botName = botName; - this.botToken = botToken; - } - - @Override - public String getBotToken() { - return botToken; - } - - @Override - public void onUpdateReceived(Update update) { - - Message message = update.getMessage(); - MessageHandler handler = getMessageHandler(message); - handler.handle(message); - } - - private MessageHandler getMessageHandler(Message message) { - return messageHandlers.stream() - .filter(e -> e.isApplicable(message)) - .findFirst() - .orElseThrow(() -> new IllegalArgumentException("Can not found applicable handler")); - } - - @Override - public String getBotUsername() { - return botName; - } -} diff --git a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/HelloWorldMessageHandler.java b/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/HelloWorldMessageHandler.java deleted file mode 100644 index 5b3f4df..0000000 --- a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/HelloWorldMessageHandler.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.myoa.engineering.crawl.ppomppu.reader.handler.message; - -import com.myoa.engineering.crawl.shopping.support.util.ObjectUtil; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; -import org.telegram.telegrambots.meta.api.objects.Message; - -@Slf4j -@Component -public class HelloWorldMessageHandler implements MessageHandler { - - @Override - public boolean isApplicable(Message message) { - return ObjectUtil.isEmpty(message); - } - - @Override - public void handle(Message message) { - // skip empty event message. - } -} diff --git a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/ImageMessageHandler.java b/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/ImageMessageHandler.java deleted file mode 100644 index 6f3ed72..0000000 --- a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/ImageMessageHandler.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.myoa.engineering.crawl.ppomppu.reader.handler.message; - -/** - * ImageHandler - * @author Shin Woo-jin (woo-jin.shin@linecorp.com) - * @since 2021-08-21 - * - */ -public interface ImageMessageHandler extends MessageHandler { - - -} diff --git a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/MessageHandler.java b/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/MessageHandler.java deleted file mode 100644 index a948fd5..0000000 --- a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/MessageHandler.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.myoa.engineering.crawl.ppomppu.reader.handler.message; - -import org.telegram.telegrambots.meta.api.objects.Message; - -/** - * MessageHandler - * @author Shin Woo-jin (woo-jin.shin@linecorp.com) - * @since 2021-08-21 - * - */ -public interface MessageHandler { - - boolean isApplicable(Message message); - - void handle(Message message); - -} diff --git a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/TextMessageHandler.java b/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/TextMessageHandler.java deleted file mode 100644 index 5e0c194..0000000 --- a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/TextMessageHandler.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.myoa.engineering.crawl.ppomppu.reader.handler.message; - -import com.myoa.engineering.crawl.shopping.support.util.ObjectUtil; -import org.telegram.telegrambots.meta.api.objects.Message; - -/** - * TextMessageHandler - * - * @author Shin Woo-jin (woo-jin.shin@linecorp.com) - * @since 2021-08-21 - */ -public interface TextMessageHandler extends MessageHandler { - - @Override - default boolean isApplicable(Message message) { - return ObjectUtil.isNotEmpty(message) && message.isUserMessage() && message.hasText(); - } -} diff --git a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/text/CommandHandler.java b/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/text/CommandHandler.java deleted file mode 100644 index f249a86..0000000 --- a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/text/CommandHandler.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.myoa.engineering.crawl.ppomppu.reader.handler.message.text; - -import java.util.List; - -import org.springframework.stereotype.Component; -import org.telegram.telegrambots.meta.api.objects.Message; - -import com.myoa.engineering.crawl.ppomppu.reader.handler.message.TextMessageHandler; - -import lombok.extern.slf4j.Slf4j; - -/** - * CommandHandler - * @author Shin Woo-jin (woo-jin.shin@linecorp.com) - * @since 2021-08-21 - * - */ -@Slf4j -@Component -public class CommandHandler implements TextMessageHandler { - - private final List processors; - - public CommandHandler(List processors) { - this.processors = processors; - } - - @Override - public boolean isApplicable(Message message) { - return TextMessageHandler.super.isApplicable(message) - && message.isCommand(); // && message.getText().startsWith("/"); - } - - @Override - public void handle(Message message) { - log.info("CommandHandler : {}", message.getText()); - TextCommandCode commandCode = TextCommandCode.find(message.getText()); - TextCommandProcessor applicableProcessor = getApplicableProcessor(commandCode); - applicableProcessor.process(message); - } - - private TextCommandProcessor getApplicableProcessor(TextCommandCode commandCode) { - return processors.stream() - .filter(e -> e.isApplicable(commandCode)) - .findFirst() - .orElseThrow(() -> new IllegalArgumentException("Can not found")); - } -} diff --git a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/text/CommonTextHandler.java b/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/text/CommonTextHandler.java deleted file mode 100644 index 46f833e..0000000 --- a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/text/CommonTextHandler.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.myoa.engineering.crawl.ppomppu.reader.handler.message.text; - -import org.springframework.stereotype.Component; -import org.telegram.telegrambots.meta.api.objects.Message; - -import com.myoa.engineering.crawl.ppomppu.reader.handler.message.TextMessageHandler; - -import lombok.extern.slf4j.Slf4j; - -/** - * NormalTextHandler - * @author Shin Woo-jin (woo-jin.shin@linecorp.com) - * @since 2021-08-21 - * - */ -@Slf4j -@Component -public class CommonTextHandler implements TextMessageHandler { - - @Override - public boolean isApplicable(Message message) { - return TextMessageHandler.super.isApplicable(message) && message.isCommand() == false; - } - - @Override - public void handle(Message message) { - log.info("CommonTextHandler : {}", message.getText()); - } - -} diff --git a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/text/EmptyTextCommandProcessor.java b/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/text/EmptyTextCommandProcessor.java deleted file mode 100644 index bb79c61..0000000 --- a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/text/EmptyTextCommandProcessor.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.myoa.engineering.crawl.ppomppu.reader.handler.message.text; - -import org.springframework.stereotype.Component; -import org.telegram.telegrambots.meta.api.objects.Message; - -/** - * EmptyTextCommandProcessor - * @author Shin Woo-jin (woo-jin.shin@linecorp.com) - * @since 2021-09-05 - * - */ -@Component -public class EmptyTextCommandProcessor implements TextCommandProcessor { - - @Override - public boolean isApplicable(TextCommandCode commandCode) { - return commandCode == TextCommandCode.EMPTY; - } - - @Override - public void process(Message message) { - - } -} diff --git a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/text/StartTextCommandProcessor.java b/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/text/StartTextCommandProcessor.java deleted file mode 100644 index 157ee0b..0000000 --- a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/text/StartTextCommandProcessor.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.myoa.engineering.crawl.ppomppu.reader.handler.message.text; - -import org.springframework.stereotype.Component; -import org.telegram.telegrambots.meta.api.objects.Message; - -import lombok.extern.slf4j.Slf4j; - -/** - * StartCommandProcessor - * @author Shin Woo-jin (woo-jin.shin@linecorp.com) - * @since 2021-09-05 - * - */ -@Slf4j -@Component -public class StartTextCommandProcessor implements TextCommandProcessor { - - @Override - public boolean isApplicable(TextCommandCode commandCode) { - return TextCommandCode.START == commandCode; - } - - @Override - public void process(Message message) { - log.info("[process] user: {}, command: {}", message.getChatId(), message.getText()); - } -} diff --git a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/text/TextCommandCode.java b/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/text/TextCommandCode.java deleted file mode 100644 index 1729af0..0000000 --- a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/text/TextCommandCode.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.myoa.engineering.crawl.ppomppu.reader.handler.message.text; - -import java.util.Arrays; - -import lombok.Getter; -import lombok.NoArgsConstructor; - -/** - * CommandTextCode - * @author Shin Woo-jin (woo-jin.shin@linecorp.com) - * @since 2021-09-05 - * - */ -@Getter -@NoArgsConstructor -public enum TextCommandCode { - EMPTY(null), - START("/start"), - ; - private String value; - - TextCommandCode(String value) { - this.value = value; - } - - public static TextCommandCode find(String value) { - return Arrays.stream(TextCommandCode.values()) - .filter(e -> e != EMPTY) - .filter(e -> value.startsWith(e.getValue())) - .findFirst() - .orElse(TextCommandCode.EMPTY); - } -} diff --git a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/text/TextCommandProcessor.java b/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/text/TextCommandProcessor.java deleted file mode 100644 index 2598d3c..0000000 --- a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/handler/message/text/TextCommandProcessor.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.myoa.engineering.crawl.ppomppu.reader.handler.message.text; - -import org.telegram.telegrambots.meta.api.objects.Message; - -/** - * TextCommandProcessor - * @author Shin Woo-jin (woo-jin.shin@linecorp.com) - * @since 2021-09-05 - * - */ -public interface TextCommandProcessor { - - boolean isApplicable(TextCommandCode commandCode); - - void process(Message message); - -} diff --git a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/infrastructure/client/ProcessorAPIWebClient.java b/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/infrastructure/client/ProcessorAPIWebClient.java deleted file mode 100644 index a55241b..0000000 --- a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/infrastructure/client/ProcessorAPIWebClient.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.myoa.engineering.crawl.ppomppu.reader.infrastructure.client; - -import org.springframework.core.ParameterizedTypeReference; -import org.springframework.stereotype.Component; -import org.springframework.web.reactive.function.client.WebClient; -import org.springframework.web.reactive.function.client.WebClientRequestException; - -import com.myoa.engineering.crawl.ppomppu.reader.dto.constant.WebClientPropertiesUnitName; -import com.myoa.engineering.crawl.shopping.support.dto.constant.PpomppuBoardName; -import com.myoa.engineering.crawl.shopping.support.webclient.factory.WebClientFilterFactory; -import com.myoa.engineering.crawl.shopping.support.webclient.properties.WebClientProperties; -import com.myoa.engineering.crawl.shopping.support.webclient.properties.WebClientProperties.WebClientPropertiesUnit; - -import lombok.extern.slf4j.Slf4j; -import reactor.core.publisher.Mono; -import reactor.core.scheduler.Schedulers; - -@Slf4j -@Component -public class ProcessorAPIWebClient { - - private final WebClient webClient; - - public ProcessorAPIWebClient(WebClientProperties webClientProperties) { - WebClientPropertiesUnit webClientPropertiesUnit = - webClientProperties.find(WebClientPropertiesUnitName.PPOMPPU_NOTIFIER_PROCESSOR_API.getUnitName()); - this.webClient = WebClient.builder() - .baseUrl(webClientPropertiesUnit.getBaseUrl()) - .filter(WebClientFilterFactory.logRequest()) - .filter(WebClientFilterFactory.logResponse()) - .build(); - } - - public Mono emitParseEvent(PpomppuBoardName boardName) { - return webClient.post() - .uri("/api/v1/crawl/boards/{boardName}", boardName) - .exchangeToMono(e -> e.bodyToMono(new ParameterizedTypeReference() {})) - .publishOn(Schedulers.boundedElastic()) - .onErrorResume(WebClientRequestException.class, t -> { - log.info("Exception occured, ignoring. : {}", t.getClass().getSimpleName()); - return Mono.empty(); - }); - } -} diff --git a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/scheduler/ParseEventEmitter.java b/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/scheduler/ParseEventEmitter.java deleted file mode 100644 index ac47fbf..0000000 --- a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/scheduler/ParseEventEmitter.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.myoa.engineering.crawl.ppomppu.reader.scheduler; - -import org.springframework.scheduling.annotation.EnableScheduling; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -import com.myoa.engineering.crawl.ppomppu.reader.service.ProcessorAPIService; -import com.myoa.engineering.crawl.shopping.support.dto.constant.PpomppuBoardName; - -import lombok.extern.slf4j.Slf4j; - -/** - * ParseEventEmitter - * @author Shin Woo-jin (woo-jin.shin@linecorp.com) - * @since 2021-09-05 - * - */ -@Slf4j -@Component -@EnableScheduling -public class ParseEventEmitter { - - private final ProcessorAPIService processorAPIService; - - public ParseEventEmitter(ProcessorAPIService processorAPIService) { - this.processorAPIService = processorAPIService; - } - - @Scheduled(fixedRate = 300 * 1000L) - public void emitBoards() { - log.info("[emitDomesticBoard] trigger fired!"); - for (PpomppuBoardName boardName : PpomppuBoardName.values()) { - processorAPIService.emitParseEvent(boardName).block(); - } - } -} diff --git a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/service/ProcessorAPIService.java b/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/service/ProcessorAPIService.java deleted file mode 100644 index 705cbeb..0000000 --- a/reader/src/main/java/com/myoa/engineering/crawl/ppomppu/reader/service/ProcessorAPIService.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.myoa.engineering.crawl.ppomppu.reader.service; - -import org.springframework.stereotype.Service; - -import com.myoa.engineering.crawl.ppomppu.reader.infrastructure.client.ProcessorAPIWebClient; -import com.myoa.engineering.crawl.shopping.support.dto.constant.PpomppuBoardName; - -import lombok.extern.slf4j.Slf4j; -import reactor.core.publisher.Mono; - -/** - * ProcessorAPIService - * @author Shin Woo-jin (woo-jin.shin@linecorp.com) - * @since 2021-09-05 - * - */ -@Slf4j -@Service -public class ProcessorAPIService { - - private final ProcessorAPIWebClient processorAPIWebClient; - - public ProcessorAPIService(ProcessorAPIWebClient processorAPIWebClient) { - this.processorAPIWebClient = processorAPIWebClient; - } - - public Mono emitParseEvent(PpomppuBoardName boardName) { - return processorAPIWebClient.emitParseEvent(boardName); - } -} diff --git a/reader/src/main/resources/application-development.yml b/reader/src/main/resources/application-development.yml deleted file mode 100644 index d9b0001..0000000 --- a/reader/src/main/resources/application-development.yml +++ /dev/null @@ -1,6 +0,0 @@ -spring: - config: - activate: - on-profile: development - import: - - "configserver:http://192.168.0.100:11080" \ No newline at end of file diff --git a/reader/src/main/resources/application-local.yml b/reader/src/main/resources/application-local.yml deleted file mode 100644 index 4de32f8..0000000 --- a/reader/src/main/resources/application-local.yml +++ /dev/null @@ -1,6 +0,0 @@ -spring: - config: - activate: - on-profile: local - import: - - "configserver:http://localhost:20085" \ No newline at end of file diff --git a/reader/src/main/resources/application-production.yml b/reader/src/main/resources/application-production.yml deleted file mode 100644 index bbd03ad..0000000 --- a/reader/src/main/resources/application-production.yml +++ /dev/null @@ -1,7 +0,0 @@ -spring: - config: - activate: - on-profile: production - import: - - classpath:/production/webclient.yml - - "configserver:http://ppn-config-server:20080" \ No newline at end of file diff --git a/reader/src/main/resources/application.yml b/reader/src/main/resources/application.yml deleted file mode 100644 index f448c67..0000000 --- a/reader/src/main/resources/application.yml +++ /dev/null @@ -1,25 +0,0 @@ -spring: - application: - name: ppn-receiver - main: - allow-bean-definition-overriding: true - profiles: - active: ${SPRING_ACTIVE_PROFILE:local} - group: - local: "local,webclient-local" - development: "development,webclient-development" - production: "production,webclient-production" - freemarker: - enabled: false - -server: - port: 20080 - error: - whitelabel: - enabled: false - -management: - endpoints: - web: - exposure: - include: refresh diff --git a/reader/src/main/resources/logback-spring.xml b/reader/src/main/resources/logback-spring.xml deleted file mode 100644 index 907a4f5..0000000 --- a/reader/src/main/resources/logback-spring.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/reader/src/main/resources/logback/component/logback-file.xml b/reader/src/main/resources/logback/component/logback-file.xml deleted file mode 100644 index 65e54db..0000000 --- a/reader/src/main/resources/logback/component/logback-file.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - ${DIRECTORY}/${LOG_FILE_BASE}_log - - ${DIRECTORY}/${LOG_FILE_BASE}_log.%d{yyyyMMdd}.%i - - 1000MB - - 60 - - - ${FILE_LOG_PATTERN} - ${IMMEDIATE_FLUSH} - - - - 1024 - - - diff --git a/reader/src/main/resources/logback/logback-development.xml b/reader/src/main/resources/logback/logback-development.xml deleted file mode 100644 index 458e3d8..0000000 --- a/reader/src/main/resources/logback/logback-development.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/reader/src/main/resources/logback/logback-production.xml b/reader/src/main/resources/logback/logback-production.xml deleted file mode 100644 index f824e41..0000000 --- a/reader/src/main/resources/logback/logback-production.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/writer/build.gradle b/writer/build.gradle deleted file mode 100644 index 3181ae3..0000000 --- a/writer/build.gradle +++ /dev/null @@ -1,23 +0,0 @@ -dependencies { - developmentOnly 'org.springframework.boot:spring-boot-devtools' - runtimeOnly 'mysql:mysql-connector-java' - compileOnly 'org.projectlombok:lombok' - - implementation project(':support') - // https://projectreactor.io/docs/core/release/reference/#debug-activate - implementation 'org.springframework.boot:spring-boot-starter-webflux' - implementation 'org.springframework.boot:spring-boot-starter-actuator' - implementation 'org.springframework.cloud:spring-cloud-starter-config' - - annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor' - annotationProcessor 'org.projectlombok:lombok' - - testImplementation 'org.springframework.boot:spring-boot-starter-test' -} - -test { - useJUnitPlatform() - testLogging { - events "passed", "skipped", "failed" - } -} \ No newline at end of file diff --git a/writer/src/main/java/com/myoa/engineering/crawl/ppomppu/writer/controller/MessageSenderAPIController.java b/writer/src/main/java/com/myoa/engineering/crawl/ppomppu/writer/controller/MessageSenderAPIController.java deleted file mode 100644 index 8a2ca3f..0000000 --- a/writer/src/main/java/com/myoa/engineering/crawl/ppomppu/writer/controller/MessageSenderAPIController.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.myoa.engineering.crawl.ppomppu.writer.controller; - -import com.myoa.engineering.crawl.ppomppu.writer.infrastructure.client.MongeShoppingBotSlackMessageSender; -import com.myoa.engineering.crawl.shopping.support.dto.APIResponse; -import com.myoa.engineering.crawl.shopping.support.dto.SimpleMessageDTO; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import reactor.core.publisher.Mono; - -/** - * MessageSenderAPIController - * @author Shin Woo-jin (woo-jin.shin@linecorp.com) - * @since 2021-11-21 - * - */ -@Slf4j -@RestController -@RequestMapping("/api/v1") -public class MessageSenderAPIController { - - private final MongeShoppingBotSlackMessageSender sender; - - public MessageSenderAPIController(MongeShoppingBotSlackMessageSender sender) { - this.sender = sender; - } - - @PostMapping("/messages/sendMessage/messengers/slack") - public Mono> sendMessageToSlack(@RequestBody SimpleMessageDTO dto) { - return sender.sendMessage(sender.ofMessage(dto.getBody())) - .then(Mono.just(APIResponse.success(dto))); - } -} diff --git a/writer/src/main/java/com/myoa/engineering/crawl/ppomppu/writer/controller/TestAPIController.java b/writer/src/main/java/com/myoa/engineering/crawl/ppomppu/writer/controller/TestAPIController.java deleted file mode 100644 index 8ec7e82..0000000 --- a/writer/src/main/java/com/myoa/engineering/crawl/ppomppu/writer/controller/TestAPIController.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.myoa.engineering.crawl.ppomppu.writer.controller; - -import com.myoa.engineering.crawl.ppomppu.writer.infrastructure.client.MongeShoppingBotSlackMessageSender; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import lombok.extern.slf4j.Slf4j; -import reactor.core.publisher.Mono; - -/** - * TestAPIController - * - * @author Shin Woo-jin (woo-jin.shin@linecorp.com) - * @since 2021-11-15 - */ -@Slf4j -@RestController -@RequestMapping("/api/v1") -public class TestAPIController { - - private final MongeShoppingBotSlackMessageSender sender; - - public TestAPIController(MongeShoppingBotSlackMessageSender sender) { - this.sender = sender; - } - - @GetMapping("/test") - public Mono test() { - log.info("received!!!"); - return sender.sendMessage(sender.ofMessage("testtesttest!!!")); - } -} diff --git a/writer/src/main/resources/application-development.yml b/writer/src/main/resources/application-development.yml deleted file mode 100644 index da50d27..0000000 --- a/writer/src/main/resources/application-development.yml +++ /dev/null @@ -1,10 +0,0 @@ -spring: - config: - activate: - on-profile: development - import: - - "configserver:http://192.168.0.100:11080" - # import: optional:configserver:http://localhost:11080 # can be start up even config server was not found. - -server: - port: 20082 diff --git a/writer/src/main/resources/application-local.yml b/writer/src/main/resources/application-local.yml deleted file mode 100644 index 5c6bfbb..0000000 --- a/writer/src/main/resources/application-local.yml +++ /dev/null @@ -1,10 +0,0 @@ -spring: - config: - activate: - on-profile: local - import: - - "configserver:http://localhost:20085" - # import: optional:configserver:http://localhost:11080 # can be start up even config server was not found. - -server: - port: 20082 diff --git a/writer/src/main/resources/application-production.yml b/writer/src/main/resources/application-production.yml deleted file mode 100644 index 4ff32ed..0000000 --- a/writer/src/main/resources/application-production.yml +++ /dev/null @@ -1,6 +0,0 @@ -spring: - config: - activate: - on-profile: production - import: - - "configserver:http://ppn-config-server:20080" diff --git a/writer/src/main/resources/application.yml b/writer/src/main/resources/application.yml deleted file mode 100644 index 32c6df7..0000000 --- a/writer/src/main/resources/application.yml +++ /dev/null @@ -1,25 +0,0 @@ -spring: - application: - name: ppn-writer - main: - allow-bean-definition-overriding: true - profiles: - active: ${SPRING_ACTIVE_PROFILE:local} - group: - local: "local,slackapi-local,webclient-local" - development: "development,slackapi-development,webclient-development" - production: "production,slackapi-production,webclient-production" - freemarker: - enabled: false - -server: - port: 20080 - error: - whitelabel: - enabled: false - -management: - endpoints: - web: - exposure: - include: refresh, env diff --git a/writer/src/main/resources/logback-spring.xml b/writer/src/main/resources/logback-spring.xml deleted file mode 100644 index 32276f3..0000000 --- a/writer/src/main/resources/logback-spring.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/writer/src/main/resources/logback/component/logback-file.xml b/writer/src/main/resources/logback/component/logback-file.xml deleted file mode 100644 index 65e54db..0000000 --- a/writer/src/main/resources/logback/component/logback-file.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - ${DIRECTORY}/${LOG_FILE_BASE}_log - - ${DIRECTORY}/${LOG_FILE_BASE}_log.%d{yyyyMMdd}.%i - - 1000MB - - 60 - - - ${FILE_LOG_PATTERN} - ${IMMEDIATE_FLUSH} - - - - 1024 - - - diff --git a/writer/src/main/resources/logback/logback-development.xml b/writer/src/main/resources/logback/logback-development.xml deleted file mode 100644 index 458e3d8..0000000 --- a/writer/src/main/resources/logback/logback-development.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/writer/src/main/resources/logback/logback-production.xml b/writer/src/main/resources/logback/logback-production.xml deleted file mode 100644 index f824e41..0000000 --- a/writer/src/main/resources/logback/logback-production.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - -