Skip to content

Commit

Permalink
Merge pull request #128 from woowa-techcamp-2024/fix/127-restaurant-s…
Browse files Browse the repository at this point in the history
…ervice-elastic-search-event

[fix] restaurant-service 에서 가게, 메뉴 관련 이벤트 핸들링 해서 elastic search에 적용하는…
  • Loading branch information
huiseung authored Aug 26, 2024
2 parents 4cc8c0c + 06e846f commit ec36611
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 4 deletions.
1 change: 1 addition & 0 deletions service/restaurant-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ dependencies {
implementation project(":domain:menu-domain-rdb")
implementation project(":domain:restaurant-domain-rdb")
implementation project(":domain:review-domain-rdb")
implementation project(":worker:worker-es")
}

tasks.named('test') {
Expand Down
8 changes: 8 additions & 0 deletions service/restaurant-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ spring:
format_sql: true
hibernate:
ddl-auto: none
elasticsearch:
uris: ${ELASTICSEARCH_URL}
username: ${ELASTICSEARCH_USERNAME}
password: ${ELASTICSEARCH_PASSWORD}
data:
elasticsearch:
repositories:
enabled: true
---
spring:
config:
Expand Down
3 changes: 3 additions & 0 deletions service/search-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ spring:
username: ${ELASTICSEARCH_USERNAME}
password: ${ELASTICSEARCH_PASSWORD}
data:
elasticsearch:
repositories:
enabled: true
redis:
password: ${REDIS_PASSWORD}

Expand Down
3 changes: 3 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,6 @@ include 'api-client:cache-client'
findProject(':api-client:cache-client')?.name = 'cache-client'
include 'api-client:search-client'
findProject(':api-client:search-client')?.name = 'search-client'
include 'worker'
include 'worker:worker-es'
findProject(':worker:worker-es')?.name = 'worker-es'
9 changes: 9 additions & 0 deletions worker/worker-es/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dependencies {
// db
implementation 'org.springframework.boot:spring-boot-starter-data-elasticsearch:2.7.18'
// module
implementation project(":domain:search-domain-es")
implementation project(":event:common-event")
implementation project(":event:restaurant-event")
implementation project(":event:menu-event")
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package woowa.team4.bff.search.service;
package woowa.team4.bff.worker.service;

import lombok.RequiredArgsConstructor;
import org.springframework.scheduling.annotation.Async;
Expand All @@ -15,8 +15,7 @@

@Service
@RequiredArgsConstructor
public class ElasticsearchIndexRegenerator {

public class ElasticsearchEventHandler {
private final RestaurantMenusRepository restaurantMenusRepository;

@Async
Expand Down Expand Up @@ -67,4 +66,4 @@ public void updateMenu(MenuUpdateEvent event) {
restaurantMenusRepository.save(search);
});
}
}
}

0 comments on commit ec36611

Please sign in to comment.