-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/10 layerd to hexagonal global infrastructure #16
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
Merged
coehgns
merged 33 commits into
main
from
feature/10-layerd-to-hexagonal-global-infrastructure
Aug 15, 2025
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
1aa6f2c
feat ( #10 ) : AwsConfig
coehgns fd59d9f
feat ( #10 ) : FilterConfig
coehgns e34394e
feat ( #10 ) : SecurityConfig
coehgns 05588ec
feat ( #10 ) : BaseEntity
coehgns ce61323
feat ( #10 ) : BaseTimeEntity
coehgns ff6c83a
feat ( #10 ) : BaseUUIDEntity
coehgns 9a24c0f
feat ( #10 ) : CasperException
coehgns a3b50d2
feat ( #10 ) : ErrorCode
coehgns fa8d7c5
feat ( #10 ) : ErrorResponse
coehgns aa391c2
feat ( #10 ) : GlobalExceptionFilter
coehgns 361159c
feat ( #10 ) : GlobalExceptionHandler
coehgns d63d976
feat ( #10 ) : ExpiredTokenException
coehgns c7e5a01
feat ( #10 ) : InternalServerErrorException
coehgns e5545d4
feat ( #10 ) : InvalidTokenException
coehgns a81e0d8
feat ( #10 ) : JwtFilter
coehgns c186db6
feat ( #10 ) : JwtProperties
coehgns 106b739
feat ( #10 ) : AdminUtils
coehgns 4111ac5
feat ( #10 ) : UserUtils
coehgns c4b257d
feat ( #10 ) : KafkaConsumerConfig
coehgns 6b07954
feat ( #10 ) : KafkaProperty
coehgns d4562ec
feat ( #10 ) : KafkaTopics
coehgns 105e190
feat ( #10 ) : DeleteFaqTableConsumer
coehgns 00a4cca
feat ( #10 ) : BadFileExtensionException
coehgns e1899fd
feat ( #10 ) : EmptyFileException
coehgns 56b8b73
feat ( #10 ) : FileUtil
coehgns 9a2f3c0
feat ( #10 ) : PathList
coehgns add59a3
feat ( #10 ) : 커밋 못한 AttachFile
coehgns b4cb0ad
refactor ( #10 ) : 중복된 build 제거
coehgns 9a2725e
refactor ( #10 ) : BaseEntity UUID 전략 수정
coehgns b08a71f
refactor ( #10 ) : FileUtil 파일 확장자 검증 로직 리팩토링
coehgns 03dbf1f
refactor ( #10 ) : GlobalExceptionHandler 메서드 네이밍 수정
coehgns 24eae29
refactor ( #10 ) : GlobalExceptionHandler kdoc 수정
coehgns 9934254
refactor ( #10 ) : FileUtil의 verificationFile 메서드의 빈문자열이거나 공백만 있는 경우도…
coehgns File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
94 changes: 94 additions & 0 deletions
94
...main/kotlin/hs/kr/entrydsm/feed/infrastructure/kafka/configuration/KafkaConsumerConfig.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| package hs.kr.entrydsm.feed.infrastructure.kafka.configuration | ||
|
|
||
| import org.apache.kafka.clients.consumer.ConsumerConfig | ||
| import org.apache.kafka.common.serialization.StringDeserializer | ||
| import org.springframework.context.annotation.Bean | ||
| import org.springframework.context.annotation.Configuration | ||
| import org.springframework.kafka.annotation.EnableKafka | ||
| import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory | ||
| import org.springframework.kafka.core.ConsumerFactory | ||
| import org.springframework.kafka.core.DefaultKafkaConsumerFactory | ||
| import org.springframework.kafka.support.serializer.JsonDeserializer | ||
|
|
||
| /** | ||
| * Kafka Consumer 설정을 담당하는 클래스입니다. | ||
| * Kafka Consumer의 기본 설정과 보안 설정을 구성합니다. | ||
| * | ||
| * @property kafkaProperty Kafka 관련 설정 프로퍼티 | ||
| */ | ||
| @EnableKafka | ||
| @Configuration | ||
| class KafkaConsumerConfig( | ||
| private val kafkaProperty: KafkaProperty, | ||
| ) { | ||
| /** | ||
| * Kafka ConsumerFactory를 생성하는 빈을 정의합니다. | ||
| * | ||
| * @return ConsumerFactory<String, Any> Kafka Consumer 인스턴스를 생성하는 팩토리 | ||
| */ | ||
| @Bean | ||
| fun consumerFactory(): ConsumerFactory<String, Any> { | ||
| return DefaultKafkaConsumerFactory(consumerFactoryConfig()) | ||
| } | ||
|
|
||
| /** | ||
| * Kafka Listener Container Factory를 생성하는 빈을 정의합니다. | ||
| * 동시성 및 컨테이너 속성을 설정합니다. | ||
| * | ||
| * @return ConcurrentKafkaListenerContainerFactory<String, Any> Kafka Listener Container 팩토리 | ||
| */ | ||
| @Bean | ||
| fun kafkaListenerContainerFactory(): ConcurrentKafkaListenerContainerFactory<String, Any> { | ||
| return ConcurrentKafkaListenerContainerFactory<String, Any>().apply { | ||
| consumerFactory = consumerFactory() | ||
| setConcurrency(2) | ||
| // Spring Kafka 3.1.x에서는 setMessageConverter 제거됨 | ||
| // JSON 변환은 JsonDeserializer에서 처리 | ||
| containerProperties.apply { | ||
| pollTimeout = 500 | ||
| isMissingTopicsFatal = false | ||
| isObservationEnabled = true | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Kafka ConsumerFactory에 사용할 설정을 생성합니다. | ||
| * | ||
| * @return Map<String, Any> Kafka Consumer 설정 맵 | ||
| */ | ||
| private fun consumerFactoryConfig(): Map<String, Any> { | ||
| return mapOf( | ||
| // 기본 설정 | ||
| ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG to kafkaProperty.serverAddress, | ||
| ConsumerConfig.ISOLATION_LEVEL_CONFIG to "read_committed", | ||
| ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG to StringDeserializer::class.java, | ||
| ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG to JsonDeserializer::class.java, | ||
| ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG to false, | ||
| ConsumerConfig.AUTO_OFFSET_RESET_CONFIG to "latest", | ||
| ConsumerConfig.MAX_POLL_INTERVAL_MS_CONFIG to 5000, | ||
| ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG to 30000, | ||
| ConsumerConfig.HEARTBEAT_INTERVAL_MS_CONFIG to 10000, | ||
| // JsonDeserializer 설정 (3.1.x 방식) | ||
| JsonDeserializer.TRUSTED_PACKAGES to "*", | ||
| JsonDeserializer.TYPE_MAPPINGS to "", | ||
| JsonDeserializer.USE_TYPE_INFO_HEADERS to false, | ||
| JsonDeserializer.VALUE_DEFAULT_TYPE to "java.lang.Object", | ||
| // Security 설정 | ||
| "security.protocol" to "SASL_PLAINTEXT", | ||
| "sasl.mechanism" to "SCRAM-SHA-512", | ||
| "sasl.jaas.config" to buildJaasConfig(), | ||
| ) | ||
| } | ||
|
|
||
| /** | ||
| * Kafka 인증을 위한 JAAS 구성을 생성합니다. | ||
| * | ||
| * @return String JAAS 구성 문자열 | ||
| */ | ||
| private fun buildJaasConfig(): String { | ||
| return "org.apache.kafka.common.security.scram.ScramLoginModule required " + | ||
| "username=\"${kafkaProperty.confluentApiKey}\" " + | ||
| "password=\"${kafkaProperty.confluentApiSecret}\";" | ||
| } | ||
|
coehgns marked this conversation as resolved.
|
||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.