Skip to content

Commit

Permalink
[Fix] Add concurrency setting
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnsugyeong committed Oct 28, 2024
1 parent 66e25fd commit 14883eb
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
import org.springframework.kafka.core.ConsumerFactory;
import org.springframework.kafka.core.DefaultKafkaConsumerFactory;
import org.springframework.kafka.listener.ContainerProperties;
import org.springframework.kafka.support.serializer.JsonDeserializer;

import java.util.Map;
Expand All @@ -27,6 +28,8 @@ public class KafkaConsumerConfig {
ConcurrentKafkaListenerContainerFactory<String, ChatMessageDto> kafkaListenerContainerFactory() {
ConcurrentKafkaListenerContainerFactory<String, ChatMessageDto> factory = new ConcurrentKafkaListenerContainerFactory<>();
factory.setConsumerFactory(consumerFactory());
factory.setConcurrency(6); // 파티션 개수에 맞춰 스레드 설정
factory.getContainerProperties().setAckMode(ContainerProperties.AckMode.MANUAL); // 수동 커밋 모드
return factory;
}

Expand Down

0 comments on commit 14883eb

Please sign in to comment.