Skip to content
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 Jul 30, 2025
fd59d9f
feat ( #10 ) : FilterConfig
coehgns Jul 30, 2025
e34394e
feat ( #10 ) : SecurityConfig
coehgns Jul 30, 2025
05588ec
feat ( #10 ) : BaseEntity
coehgns Jul 30, 2025
ce61323
feat ( #10 ) : BaseTimeEntity
coehgns Jul 30, 2025
ff6c83a
feat ( #10 ) : BaseUUIDEntity
coehgns Jul 30, 2025
9a24c0f
feat ( #10 ) : CasperException
coehgns Jul 30, 2025
a3b50d2
feat ( #10 ) : ErrorCode
coehgns Jul 30, 2025
fa8d7c5
feat ( #10 ) : ErrorResponse
coehgns Jul 30, 2025
aa391c2
feat ( #10 ) : GlobalExceptionFilter
coehgns Jul 30, 2025
361159c
feat ( #10 ) : GlobalExceptionHandler
coehgns Jul 30, 2025
d63d976
feat ( #10 ) : ExpiredTokenException
coehgns Jul 30, 2025
c7e5a01
feat ( #10 ) : InternalServerErrorException
coehgns Jul 30, 2025
e5545d4
feat ( #10 ) : InvalidTokenException
coehgns Jul 30, 2025
a81e0d8
feat ( #10 ) : JwtFilter
coehgns Jul 30, 2025
c186db6
feat ( #10 ) : JwtProperties
coehgns Jul 30, 2025
106b739
feat ( #10 ) : AdminUtils
coehgns Aug 1, 2025
4111ac5
feat ( #10 ) : UserUtils
coehgns Aug 1, 2025
c4b257d
feat ( #10 ) : KafkaConsumerConfig
coehgns Aug 1, 2025
6b07954
feat ( #10 ) : KafkaProperty
coehgns Aug 1, 2025
d4562ec
feat ( #10 ) : KafkaTopics
coehgns Aug 1, 2025
105e190
feat ( #10 ) : DeleteFaqTableConsumer
coehgns Aug 1, 2025
00a4cca
feat ( #10 ) : BadFileExtensionException
coehgns Aug 1, 2025
e1899fd
feat ( #10 ) : EmptyFileException
coehgns Aug 1, 2025
56b8b73
feat ( #10 ) : FileUtil
coehgns Aug 1, 2025
9a2f3c0
feat ( #10 ) : PathList
coehgns Aug 1, 2025
add59a3
feat ( #10 ) : 커밋 못한 AttachFile
coehgns Aug 1, 2025
b4cb0ad
refactor ( #10 ) : 중복된 build 제거
coehgns Aug 2, 2025
9a2725e
refactor ( #10 ) : BaseEntity UUID 전략 수정
coehgns Aug 2, 2025
b08a71f
refactor ( #10 ) : FileUtil 파일 확장자 검증 로직 리팩토링
coehgns Aug 2, 2025
03dbf1f
refactor ( #10 ) : GlobalExceptionHandler 메서드 네이밍 수정
coehgns Aug 2, 2025
24eae29
refactor ( #10 ) : GlobalExceptionHandler kdoc 수정
coehgns Aug 2, 2025
9934254
refactor ( #10 ) : FileUtil의 verificationFile 메서드의 빈문자열이거나 공백만 있는 경우도…
coehgns Aug 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}\";"
}
Comment thread
coehgns marked this conversation as resolved.
Comment thread
coehgns marked this conversation as resolved.
}