From 0de70fa4d83c76a535ef85607708c562082a029b Mon Sep 17 00:00:00 2001 From: coehgns Date: Fri, 1 Aug 2025 17:57:14 +0900 Subject: [PATCH 01/19] feat ( #20 ) : InternalAdminResponse --- .../client/dto/response/InternalAdminResponse.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 casper-feed/src/main/kotlin/hs/kr/entrydsm/feed/infrastructure/grpc/client/dto/response/InternalAdminResponse.kt diff --git a/casper-feed/src/main/kotlin/hs/kr/entrydsm/feed/infrastructure/grpc/client/dto/response/InternalAdminResponse.kt b/casper-feed/src/main/kotlin/hs/kr/entrydsm/feed/infrastructure/grpc/client/dto/response/InternalAdminResponse.kt new file mode 100644 index 0000000..e4e33cc --- /dev/null +++ b/casper-feed/src/main/kotlin/hs/kr/entrydsm/feed/infrastructure/grpc/client/dto/response/InternalAdminResponse.kt @@ -0,0 +1,12 @@ +package hs.kr.entrydsm.feed.infrastructure.grpc.client.dto.response + +import java.util.UUID + +/** + * 관리자 정보를 담는 데이터 클래스입니다. + * + * @property id 관리자의 고유 식별자(UUID) + */ +data class InternalAdminResponse( + val id: UUID +) From cd3e381fd91a07193e81d55ef8f005b8a55e35f3 Mon Sep 17 00:00:00 2001 From: coehgns Date: Fri, 1 Aug 2025 17:57:21 +0900 Subject: [PATCH 02/19] feat ( #20 ) : AdminGrpcClient --- .../grpc/client/AdminGrpcClient.kt | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 casper-feed/src/main/kotlin/hs/kr/entrydsm/feed/infrastructure/grpc/client/AdminGrpcClient.kt diff --git a/casper-feed/src/main/kotlin/hs/kr/entrydsm/feed/infrastructure/grpc/client/AdminGrpcClient.kt b/casper-feed/src/main/kotlin/hs/kr/entrydsm/feed/infrastructure/grpc/client/AdminGrpcClient.kt new file mode 100644 index 0000000..7623471 --- /dev/null +++ b/casper-feed/src/main/kotlin/hs/kr/entrydsm/feed/infrastructure/grpc/client/AdminGrpcClient.kt @@ -0,0 +1,39 @@ +package hs.kr.entrydsm.feed.infrastructure.grpc.client + +import hs.kr.entrydsm.casper.admin.proto.AdminServiceGrpc +import hs.kr.entrydsm.casper.admin.proto.AdminServiceProto +import hs.kr.entrydsm.feed.infrastructure.grpc.client.dto.response.InternalAdminResponse +import io.grpc.Channel +import net.devh.boot.grpc.client.inject.GrpcClient +import org.springframework.stereotype.Component +import java.util.UUID + +/** + * 관리자 서비스와의 gRPC 통신을 담당하는 클라이언트 클래스입니다. + * + * @property channel gRPC 통신을 위한 채널 (user-service로 자동 주입됨) + */ +@Component +class AdminGrpcClient { + + @GrpcClient("user-service") + lateinit var channel: Channel + + /** + * 관리자 ID를 기반으로 관리자 정보를 조회합니다. + * + * @param adminId 조회할 관리자의 고유 식별자(UUID) + * @return 조회된 관리자 정보를 담은 [InternalAdminResponse] 객체 + * @throws io.grpc.StatusRuntimeException gRPC 통신 중 오류가 발생한 경우 + */ + suspend fun getAdminInfoByAdminId(adminId: UUID): InternalAdminResponse { + val adminStub = AdminServiceGrpc.newBlockingStub(channel) + + val request = AdminServiceProto.GetAdminIdRequest.newBuilder() + .setAdminId(adminId.toString()) + .build() + val response = adminStub.getAdminByUUID(request) + + return InternalAdminResponse(id = UUID.fromString(response.adminId)) + } +} From e8524725b521bcbc6cbb8c0746dcac05abf72d08 Mon Sep 17 00:00:00 2001 From: coehgns Date: Fri, 1 Aug 2025 17:57:29 +0900 Subject: [PATCH 03/19] feat ( #20 ) : admin.proto --- casper-feed/src/main/proto/admin.proto | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 casper-feed/src/main/proto/admin.proto diff --git a/casper-feed/src/main/proto/admin.proto b/casper-feed/src/main/proto/admin.proto new file mode 100644 index 0000000..082a59d --- /dev/null +++ b/casper-feed/src/main/proto/admin.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; + +package admin.proto; + +option java_package = "hs.kr.entrydsm.casper.admin.proto"; +option java_outer_classname = "AdminServiceProto"; + +service AdminService { + rpc GetAdminByUUID(GetAdminIdRequest) returns (GetAdminIdResponse); +} + +message GetAdminIdRequest { + string admin_id =1; +} + +message GetAdminIdResponse{ + string admin_id = 1; +} From 31dbbfa5b31563e95a95946255916fd9f0ad555c Mon Sep 17 00:00:00 2001 From: coehgns Date: Fri, 1 Aug 2025 17:57:50 +0900 Subject: [PATCH 04/19] =?UTF-8?q?chore=20(=20#20=20)=20:=20=EB=88=84?= =?UTF-8?q?=EB=9D=BD=EB=90=9C=20=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feed/CasperFeedApplicationTests.kt | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 casper-feed/src/test/kotlin/hs/kr/entrydsm/feed/CasperFeedApplicationTests.kt diff --git a/casper-feed/src/test/kotlin/hs/kr/entrydsm/feed/CasperFeedApplicationTests.kt b/casper-feed/src/test/kotlin/hs/kr/entrydsm/feed/CasperFeedApplicationTests.kt new file mode 100644 index 0000000..43b364e --- /dev/null +++ b/casper-feed/src/test/kotlin/hs/kr/entrydsm/feed/CasperFeedApplicationTests.kt @@ -0,0 +1,26 @@ +package hs.kr.entrydsm.feed + +import org.junit.jupiter.api.Test +import org.springframework.boot.test.context.SpringBootTest + +/** + * Casper Feed 애플리케이션의 통합 테스트 클래스입니다. + * + * 이 클래스는 Spring 애플리케이션 컨텍스트가 모든 필요한 빈과 설정과 함께 + * 성공적으로 로드되는지 검증합니다. + */ +@SpringBootTest(classes = [CasperFeedApplication::class]) +class CasperFeedApplicationTests { + + /** + * 애플리케이션 컨텍스트가 성공적으로 로드되는지 테스트합니다. + * + * 이 테스트는 Spring 애플리케이션 컨텍스트가 모든 필요한 설정과 빈이 제대로 + * 초기화된 상태로 시작될 수 있는지 확인합니다. + * 컨텍스트 로딩에 실패할 경우 이 테스트는 실패합니다. + */ + @Test + fun contextLoads() { + // 애플리케이션 컨텍스트가 성공적으로 로드되면 테스트가 통과합니다. + } +} From 92bcf330f419d9797396928db5f93f735b33eac3 Mon Sep 17 00:00:00 2001 From: coehgns Date: Fri, 1 Aug 2025 17:58:29 +0900 Subject: [PATCH 05/19] =?UTF-8?q?build=20(=20#20=20)=20:=20gRPC=20Dependen?= =?UTF-8?q?cies=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildSrc/src/main/kotlin/Dependencies.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 1aae290..f170576 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -38,7 +38,9 @@ object Dependencies { const val GRPC_KOTLIN_STUB = "io.grpc:grpc-kotlin-stub:${DependencyVersion.GRPC_KOTLIN}" const val PROTOBUF_KOTLIN = "com.google.protobuf:protobuf-kotlin:${DependencyVersion.PROTOBUF}" const val GRPC_TESTING = "io.grpc:grpc-testing:${DependencyVersion.GRPC}" - + const val GRPC_SERVER = "net.devh:grpc-server-spring-boot-starter:${DependencyVersion.GRPC_SERVER}" + const val GRPC_CLIENT = "net.devh:grpc-client-spring-boot-starter:${DependencyVersion.GRPC_CLIENT}" + const val GOOGLE_PROTOBUF = "com.google.protobuf:protobuf-java:${DependencyVersion.GOGGLE_PROTOBUF}" // swagger const val SWAGGER = "org.springdoc:springdoc-openapi-starter-webmvc-ui:${DependencyVersion.SWAGGER_VERSION}" From 8d42d7faf0950437586fd833dcf5598f361bea5d Mon Sep 17 00:00:00 2001 From: coehgns Date: Fri, 1 Aug 2025 17:58:34 +0900 Subject: [PATCH 06/19] =?UTF-8?q?build=20(=20#20=20)=20:=20gRPC=20Dependen?= =?UTF-8?q?ciesVersion=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildSrc/src/main/kotlin/DependencyVersion.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/buildSrc/src/main/kotlin/DependencyVersion.kt b/buildSrc/src/main/kotlin/DependencyVersion.kt index 17d8889..83b4082 100644 --- a/buildSrc/src/main/kotlin/DependencyVersion.kt +++ b/buildSrc/src/main/kotlin/DependencyVersion.kt @@ -12,6 +12,9 @@ object DependencyVersion { const val GRPC = "1.61.1" const val GRPC_KOTLIN = "1.4.1" const val PROTOBUF = "3.25.3" + const val GRPC_SERVER = "2.15.0.RELEASE" + const val GRPC_CLIENT = "2.15.0.RELEASE" + const val GOGGLE_PROTOBUF = "3.25.3" const val SWAGGER_VERSION = "2.5.0" const val AWS = "1.12.281" From 2a2567c63bcca7b3d2a2cf772725a4fee3c33566 Mon Sep 17 00:00:00 2001 From: coehgns Date: Fri, 1 Aug 2025 17:58:51 +0900 Subject: [PATCH 07/19] =?UTF-8?q?build=20(=20#20=20)=20:=20kotlin=20versio?= =?UTF-8?q?n=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildSrc/src/main/kotlin/PluginVersion.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/PluginVersion.kt b/buildSrc/src/main/kotlin/PluginVersion.kt index 9b16506..ec67b6d 100644 --- a/buildSrc/src/main/kotlin/PluginVersion.kt +++ b/buildSrc/src/main/kotlin/PluginVersion.kt @@ -1,8 +1,8 @@ object PluginVersion { - const val KOTLIN_VERSION = "1.9.25" + const val KOTLIN_VERSION = "1.9.23" const val SPRING_BOOT_VERSION = "3.4.4" const val SPRING_DEPENDENCY_MANAGEMENT_VERSION = "1.1.7" const val DETEKT_VERSION = "1.23.6" const val KTLINT_VERSION = "12.1.1" const val PROTOBUF_VERSION = "0.9.4" -} \ No newline at end of file +} From c1d20e2b3d6c690580281bc0b11f49910ae09cee Mon Sep 17 00:00:00 2001 From: coehgns Date: Fri, 1 Aug 2025 17:59:05 +0900 Subject: [PATCH 08/19] =?UTF-8?q?build=20(=20#20=20)=20:=20detekt.yml=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- detekt.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/detekt.yml b/detekt.yml index c7d1683..16badba 100644 --- a/detekt.yml +++ b/detekt.yml @@ -1,7 +1,7 @@ complexity: active: true LongParameterList: - active: true + active: false functionThreshold: 6 constructorThreshold: 7 @@ -11,7 +11,7 @@ style: active: true maxLineLength: 120 MagicNumber: - active: true + active: false ignoreNumbers: - '-1' - '0' From c8474fc7b617318b4bfa38565aa366b56f6ffcb6 Mon Sep 17 00:00:00 2001 From: coehgns Date: Fri, 1 Aug 2025 17:59:21 +0900 Subject: [PATCH 09/19] =?UTF-8?q?build=20(=20#20=20)=20:=20=EB=88=84?= =?UTF-8?q?=EB=9D=BD=EB=90=9C=20=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- casper-feed/build.gradle.kts | 126 +++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 casper-feed/build.gradle.kts diff --git a/casper-feed/build.gradle.kts b/casper-feed/build.gradle.kts new file mode 100644 index 0000000..c186530 --- /dev/null +++ b/casper-feed/build.gradle.kts @@ -0,0 +1,126 @@ +plugins { + id(Plugin.KOTLIN_JVM) version PluginVersion.KOTLIN_VERSION + id(Plugin.KOTLIN_SPRING) version PluginVersion.KOTLIN_VERSION + id(Plugin.KOTLIN_KAPT) + id(Plugin.SPRING_BOOT) version PluginVersion.SPRING_BOOT_VERSION + id(Plugin.SPRING_DEPENDENCY_MANAGEMENT) version PluginVersion.SPRING_DEPENDENCY_MANAGEMENT_VERSION + id(Plugin.CASPER_DOCUMENTATION) + id(Plugin.PROTOBUF) version PluginVersion.PROTOBUF_VERSION +} + +group = "hs.kr.entrydsm" +version = "0.0.1-SNAPSHOT" + +java { + toolchain { + languageVersion = JavaLanguageVersion.of(17) + } +} + +repositories { + mavenCentral() +} + +dependencies { + // 스프링 부트 기본 기능 + implementation(Dependencies.SPRING_BOOT_STARTER) + + // 코틀린 리플렉션 + implementation(Dependencies.KOTLIN_REFLECT) + + // 스프링 부트 테스트 도구 + testImplementation(Dependencies.SPRING_BOOT_STARTER_TEST) + + // 코틀린 + JUnit5 테스트 + testImplementation(Dependencies.KOTLIN_TEST_JUNIT5) + + // JUnit5 실행 런처 + testRuntimeOnly(Dependencies.JUNIT_PLATFORM_LAUNCHER) + + // 웹 관련 + implementation(Dependencies.SPRING_BOOT_STARTER_WEB) + + // 데이터베이스 + implementation(Dependencies.SPRING_BOOT_STARTER_DATA_JPA) + implementation(Dependencies.SPRING_BOOT_STARTER_DATA_REDIS) + runtimeOnly(Dependencies.MYSQL_CONNECTOR) + + // 보안 + implementation(Dependencies.SPRING_BOOT_STARTER_SECURITY) + + // 검증 + implementation(Dependencies.SPRING_BOOT_STARTER_VALIDATION) + + // JSON 처리 + implementation(Dependencies.JACKSON_MODULE_KOTLIN) + implementation(Dependencies.ORG_JSON) + + // JWT + implementation(Dependencies.JWT_API) + implementation(Dependencies.JWT_IMPL) + runtimeOnly(Dependencies.JWT_JACKSON) + + implementation(Dependencies.MAPSTRUCT) + kapt(Dependencies.MAPSTRUCT_PROCESSOR) + + // grpc + implementation(Dependencies.GRPC_NETTY_SHADED) + implementation(Dependencies.GRPC_PROTOBUF) + implementation(Dependencies.GRPC_STUB) + implementation(Dependencies.GRPC_KOTLIN_STUB) + implementation(Dependencies.PROTOBUF_KOTLIN) + testImplementation(Dependencies.GRPC_TESTING) + implementation(Dependencies.GRPC_SERVER) + implementation(Dependencies.GRPC_CLIENT) + implementation(Dependencies.GOOGLE_PROTOBUF) + + // swagger + implementation(Dependencies.SWAGGER) + + // aws + implementation(Dependencies.AWS) + + // feign + implementation(Dependencies.OPEN_FEIGN) + + // Kafka + implementation(Dependencies.KAFKA) + implementation("org.springframework.kafka:spring-kafka:3.1.2") + + // Cloud Config + // implementation(Dependencies.CLOUD_CONFIG) +} + +protobuf { + protoc { + artifact = "com.google.protobuf:protoc:${DependencyVersion.PROTOBUF}" + } + plugins { + create("grpc") { + artifact = "io.grpc:protoc-gen-grpc-java:${DependencyVersion.GRPC}" + } + create("grpckt") { + artifact = "io.grpc:protoc-gen-grpc-kotlin:${DependencyVersion.GRPC_KOTLIN}:jdk8@jar" + } + } + generateProtoTasks { + all().forEach { + it.plugins { + create("grpc") + create("grpckt") + } + } + + } + +} + +kotlin { + compilerOptions { + freeCompilerArgs.addAll("-Xjsr305=strict") + } +} + +tasks.withType { + useJUnitPlatform() +} From e6775e709bced35882e7542fec2b8d07dd052d29 Mon Sep 17 00:00:00 2001 From: coehgns Date: Sat, 2 Aug 2025 15:07:11 +0900 Subject: [PATCH 10/19] =?UTF-8?q?feat=20(=20#20=20)=20:=20admin.proto=20?= =?UTF-8?q?=ED=8C=A8=ED=82=A4=EC=A7=80=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- casper-feed/src/main/proto/admin.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/casper-feed/src/main/proto/admin.proto b/casper-feed/src/main/proto/admin.proto index 082a59d..ab6fa28 100644 --- a/casper-feed/src/main/proto/admin.proto +++ b/casper-feed/src/main/proto/admin.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package admin.proto; +package casper.feed; option java_package = "hs.kr.entrydsm.casper.admin.proto"; option java_outer_classname = "AdminServiceProto"; From e869946c17614f1e5184fef54f0a270a96ea925e Mon Sep 17 00:00:00 2001 From: coehgns Date: Sat, 2 Aug 2025 20:52:40 +0900 Subject: [PATCH 11/19] =?UTF-8?q?build=20(=20#20=20)=20:=20Dependencies?= =?UTF-8?q?=EC=97=90=20=EC=9D=98=EC=A1=B4=EC=84=B1=20=EC=98=A4=ED=83=80=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildSrc/src/main/kotlin/Dependencies.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index f170576..5c28596 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -40,7 +40,7 @@ object Dependencies { const val GRPC_TESTING = "io.grpc:grpc-testing:${DependencyVersion.GRPC}" const val GRPC_SERVER = "net.devh:grpc-server-spring-boot-starter:${DependencyVersion.GRPC_SERVER}" const val GRPC_CLIENT = "net.devh:grpc-client-spring-boot-starter:${DependencyVersion.GRPC_CLIENT}" - const val GOOGLE_PROTOBUF = "com.google.protobuf:protobuf-java:${DependencyVersion.GOGGLE_PROTOBUF}" + const val GOOGLE_PROTOBUF = "com.google.protobuf:protobuf-java:${DependencyVersion.GOOGLE_PROTOBUF}" // swagger const val SWAGGER = "org.springdoc:springdoc-openapi-starter-webmvc-ui:${DependencyVersion.SWAGGER_VERSION}" From 3dd4807beb3f5c1ec7c90ff0cb7c2459259ac6a7 Mon Sep 17 00:00:00 2001 From: coehgns Date: Sat, 2 Aug 2025 20:52:54 +0900 Subject: [PATCH 12/19] =?UTF-8?q?build=20(=20#20=20)=20:=20DependencyVersi?= =?UTF-8?q?on=EC=97=90=20=EC=9D=98=EC=A1=B4=EC=84=B1=20=EC=98=A4=ED=83=80?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildSrc/src/main/kotlin/DependencyVersion.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/DependencyVersion.kt b/buildSrc/src/main/kotlin/DependencyVersion.kt index 83b4082..5525b19 100644 --- a/buildSrc/src/main/kotlin/DependencyVersion.kt +++ b/buildSrc/src/main/kotlin/DependencyVersion.kt @@ -14,7 +14,7 @@ object DependencyVersion { const val PROTOBUF = "3.25.3" const val GRPC_SERVER = "2.15.0.RELEASE" const val GRPC_CLIENT = "2.15.0.RELEASE" - const val GOGGLE_PROTOBUF = "3.25.3" + const val GOOGLE_PROTOBUF = "3.25.3" const val SWAGGER_VERSION = "2.5.0" const val AWS = "1.12.281" From fc0d926f449cdb2f4d29813eefca90b02699fb89 Mon Sep 17 00:00:00 2001 From: coehgns Date: Sat, 2 Aug 2025 21:17:07 +0900 Subject: [PATCH 13/19] =?UTF-8?q?build=20(=20#20=20)=20:=20Dependencies?= =?UTF-8?q?=EC=97=90=20=EC=BD=94=EB=A3=A8=ED=8B=B4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildSrc/src/main/kotlin/Dependencies.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 5c28596..2806742 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -42,6 +42,9 @@ object Dependencies { const val GRPC_CLIENT = "net.devh:grpc-client-spring-boot-starter:${DependencyVersion.GRPC_CLIENT}" const val GOOGLE_PROTOBUF = "com.google.protobuf:protobuf-java:${DependencyVersion.GOOGLE_PROTOBUF}" + // coroutines + const val COROUTINES = "org.jetbrains.kotlinx:kotlinx-coroutines-core:${DependencyVersion.COROUTINES}" + // swagger const val SWAGGER = "org.springdoc:springdoc-openapi-starter-webmvc-ui:${DependencyVersion.SWAGGER_VERSION}" From 160a967db38dd5420ad843637d04a8d045a6c9c1 Mon Sep 17 00:00:00 2001 From: coehgns Date: Sat, 2 Aug 2025 21:17:13 +0900 Subject: [PATCH 14/19] =?UTF-8?q?build=20(=20#20=20)=20:=20DependencyVersi?= =?UTF-8?q?on=EC=97=90=20=EC=BD=94=EB=A3=A8=ED=8B=B4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildSrc/src/main/kotlin/DependencyVersion.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/buildSrc/src/main/kotlin/DependencyVersion.kt b/buildSrc/src/main/kotlin/DependencyVersion.kt index 5525b19..f0b60a8 100644 --- a/buildSrc/src/main/kotlin/DependencyVersion.kt +++ b/buildSrc/src/main/kotlin/DependencyVersion.kt @@ -4,6 +4,7 @@ object DependencyVersion { const val SPRING_DEPENDENCY_MANAGEMENT = "1.1.7" const val DETEKT = "1.23.6" const val KTLINT = "12.1.1" + const val COROUTINES = "1.8.0" const val JWT = "0.11.5" const val ORG_JSON = "20230227" From 0c6f6bd7bf76dd1cafa3a7f083425364e003085f Mon Sep 17 00:00:00 2001 From: coehgns Date: Sat, 2 Aug 2025 21:17:23 +0900 Subject: [PATCH 15/19] =?UTF-8?q?build=20(=20#20=20)=20:=20=EC=BD=94?= =?UTF-8?q?=EB=A3=A8=ED=8B=B4=20=EC=9D=98=EC=A1=B4=EC=84=B1=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- casper-feed/build.gradle.kts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/casper-feed/build.gradle.kts b/casper-feed/build.gradle.kts index c186530..a47fade 100644 --- a/casper-feed/build.gradle.kts +++ b/casper-feed/build.gradle.kts @@ -70,10 +70,12 @@ dependencies { implementation(Dependencies.GRPC_KOTLIN_STUB) implementation(Dependencies.PROTOBUF_KOTLIN) testImplementation(Dependencies.GRPC_TESTING) - implementation(Dependencies.GRPC_SERVER) implementation(Dependencies.GRPC_CLIENT) implementation(Dependencies.GOOGLE_PROTOBUF) + // 코루틴 + implementation(Dependencies.COROUTINES) + // swagger implementation(Dependencies.SWAGGER) From f2bac81208b88608770f73e74a6a828edd49e68c Mon Sep 17 00:00:00 2001 From: coehgns Date: Sat, 2 Aug 2025 21:46:32 +0900 Subject: [PATCH 16/19] =?UTF-8?q?refactor=20(=20#20=20)=20:=20Stub?= =?UTF-8?q?=EC=9D=84=20=EB=B9=84=EB=8F=99=EA=B8=B0=20=EC=B2=98=EB=A6=AC?= =?UTF-8?q?=EC=97=90=20=EB=A7=9E=EA=B2=8C=20=EB=A1=9C=EC=A7=81=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../grpc/client/AdminGrpcClient.kt | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/casper-feed/src/main/kotlin/hs/kr/entrydsm/feed/infrastructure/grpc/client/AdminGrpcClient.kt b/casper-feed/src/main/kotlin/hs/kr/entrydsm/feed/infrastructure/grpc/client/AdminGrpcClient.kt index 7623471..c0942a8 100644 --- a/casper-feed/src/main/kotlin/hs/kr/entrydsm/feed/infrastructure/grpc/client/AdminGrpcClient.kt +++ b/casper-feed/src/main/kotlin/hs/kr/entrydsm/feed/infrastructure/grpc/client/AdminGrpcClient.kt @@ -4,9 +4,13 @@ import hs.kr.entrydsm.casper.admin.proto.AdminServiceGrpc import hs.kr.entrydsm.casper.admin.proto.AdminServiceProto import hs.kr.entrydsm.feed.infrastructure.grpc.client.dto.response.InternalAdminResponse import io.grpc.Channel +import io.grpc.stub.StreamObserver +import kotlinx.coroutines.suspendCancellableCoroutine import net.devh.boot.grpc.client.inject.GrpcClient import org.springframework.stereotype.Component import java.util.UUID +import kotlin.coroutines.resume +import kotlin.coroutines.resumeWithException /** * 관리자 서비스와의 gRPC 통신을 담당하는 클라이언트 클래스입니다. @@ -19,20 +23,34 @@ class AdminGrpcClient { @GrpcClient("user-service") lateinit var channel: Channel + /** - * 관리자 ID를 기반으로 관리자 정보를 조회합니다. + * 관리자 ID를 기반으로 관리자 정보를 비동기적으로 조회합니다. + * gRPC 비동기 스트리밍을 사용하여 관리자 서비스로부터 정보를 가져옵니다. * * @param adminId 조회할 관리자의 고유 식별자(UUID) * @return 조회된 관리자 정보를 담은 [InternalAdminResponse] 객체 - * @throws io.grpc.StatusRuntimeException gRPC 통신 중 오류가 발생한 경우 + * @throws io.grpc.StatusRuntimeException gRPC 서버에서 오류가 발생한 경우 + * @throws java.util.concurrent.CancellationException 코루틴이 취소된 경우 */ suspend fun getAdminInfoByAdminId(adminId: UUID): InternalAdminResponse { - val adminStub = AdminServiceGrpc.newBlockingStub(channel) + val adminStub = AdminServiceGrpc.newStub(channel) val request = AdminServiceProto.GetAdminIdRequest.newBuilder() .setAdminId(adminId.toString()) .build() - val response = adminStub.getAdminByUUID(request) + + val response = suspendCancellableCoroutine { continuation -> + adminStub.getAdminByUUID(request, object : StreamObserver { + override fun onNext(value: AdminServiceProto.GetAdminIdResponse) { + continuation.resume(value) + } + override fun onError(t: Throwable) { + continuation.resumeWithException(t) + } + override fun onCompleted() {} + }) + } return InternalAdminResponse(id = UUID.fromString(response.adminId)) } From 983b9338ca910a21fa457f3269eab3de821b1267 Mon Sep 17 00:00:00 2001 From: coehgns Date: Sat, 2 Aug 2025 21:48:34 +0900 Subject: [PATCH 17/19] =?UTF-8?q?chore=20(=20#20=20)=20:=20Dependencies?= =?UTF-8?q?=EC=97=90=20=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C=20=EC=9D=98?= =?UTF-8?q?=EC=A1=B4=EC=84=B1=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildSrc/src/main/kotlin/Dependencies.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 2806742..35b8bf7 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -38,7 +38,6 @@ object Dependencies { const val GRPC_KOTLIN_STUB = "io.grpc:grpc-kotlin-stub:${DependencyVersion.GRPC_KOTLIN}" const val PROTOBUF_KOTLIN = "com.google.protobuf:protobuf-kotlin:${DependencyVersion.PROTOBUF}" const val GRPC_TESTING = "io.grpc:grpc-testing:${DependencyVersion.GRPC}" - const val GRPC_SERVER = "net.devh:grpc-server-spring-boot-starter:${DependencyVersion.GRPC_SERVER}" const val GRPC_CLIENT = "net.devh:grpc-client-spring-boot-starter:${DependencyVersion.GRPC_CLIENT}" const val GOOGLE_PROTOBUF = "com.google.protobuf:protobuf-java:${DependencyVersion.GOOGLE_PROTOBUF}" From 2907e9b1d712f9382f6a82a1732407f9bef630dc Mon Sep 17 00:00:00 2001 From: coehgns Date: Sat, 2 Aug 2025 21:48:41 +0900 Subject: [PATCH 18/19] =?UTF-8?q?chore=20(=20#20=20)=20:=20DependencyVersi?= =?UTF-8?q?on=EC=97=90=20=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C=20=EC=9D=98?= =?UTF-8?q?=EC=A1=B4=EC=84=B1=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildSrc/src/main/kotlin/DependencyVersion.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/DependencyVersion.kt b/buildSrc/src/main/kotlin/DependencyVersion.kt index f0b60a8..295cf53 100644 --- a/buildSrc/src/main/kotlin/DependencyVersion.kt +++ b/buildSrc/src/main/kotlin/DependencyVersion.kt @@ -13,7 +13,6 @@ object DependencyVersion { const val GRPC = "1.61.1" const val GRPC_KOTLIN = "1.4.1" const val PROTOBUF = "3.25.3" - const val GRPC_SERVER = "2.15.0.RELEASE" const val GRPC_CLIENT = "2.15.0.RELEASE" const val GOOGLE_PROTOBUF = "3.25.3" From b175734c401a4fe5a5ab456c372d8282a295f15b Mon Sep 17 00:00:00 2001 From: coehgns Date: Mon, 11 Aug 2025 15:41:15 +0900 Subject: [PATCH 19/19] refactor ( #20 ) : AdminGrpcClient.kt --- .../entrydsm/feed/infrastructure/grpc/client/AdminGrpcClient.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/casper-feed/src/main/kotlin/hs/kr/entrydsm/feed/infrastructure/grpc/client/AdminGrpcClient.kt b/casper-feed/src/main/kotlin/hs/kr/entrydsm/feed/infrastructure/grpc/client/AdminGrpcClient.kt index c0942a8..eb60c30 100644 --- a/casper-feed/src/main/kotlin/hs/kr/entrydsm/feed/infrastructure/grpc/client/AdminGrpcClient.kt +++ b/casper-feed/src/main/kotlin/hs/kr/entrydsm/feed/infrastructure/grpc/client/AdminGrpcClient.kt @@ -23,7 +23,6 @@ class AdminGrpcClient { @GrpcClient("user-service") lateinit var channel: Channel - /** * 관리자 ID를 기반으로 관리자 정보를 비동기적으로 조회합니다. * gRPC 비동기 스트리밍을 사용하여 관리자 서비스로부터 정보를 가져옵니다.