Skip to content

Commit

Permalink
Merge pull request #340 from 6QuizOnTheBlock/be/feat/#333-send-question
Browse files Browse the repository at this point in the history
hotfix: ๋ฐฐํฌ ํ™˜๊ฒฝ์—์„œ Consumer ๋กœ ๋ฉ”์„ธ์ง€๊ฐ€ ์•ˆ ์˜ค๋Š” ๋ฌธ์ œ ํ•ด๊ฒฐ
  • Loading branch information
dalcheonroadhead authored May 16, 2024
2 parents 24d2841 + 7391b81 commit 156148a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class MessageReceive {
private final SimpMessageSendingOperations template;
private final ChatRepository chatRepository;

@KafkaListener(topics = ConstantUtil.KAFKA_TOPIC, containerFactory = "kafkaListenerContainerFactory")
@KafkaListener(topics = ConstantUtil.KAFKA_TOPIC, containerFactory = "chatContainerFactory")
public void receiveMessage(Message message) {
log.info("์ „์†ก ์œ„์น˜ = /subscribe/public/" + message.getRoomId());
log.info("์ฑ„ํŒ… ๋ฐฉ์œผ๋กœ ๋ฉ”์‹œ์ง€ ์ „์†ก = {}", message.getContent());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class QuizReceive {
@Value("${kafka.group}")
String kafkaGroup;

@KafkaListener(topics = ConstantUtil.QUIZ_GAMER, groupId = "group-id", containerFactory = "gamerListenerContainerFactory", concurrency = "4")
@KafkaListener(topics = ConstantUtil.QUIZ_GAMER, groupId = "group-2", containerFactory = "gamerListenerContainerFactory", concurrency = "4")
public void receivedGamer(GamerDTO gamer) {
log.info("/gamer/" + gamer.quizGameId());
log.info("๊ฒŒ์ด๋จธ ์ƒ์„ธ={}", gamer.toString());
Expand All @@ -51,7 +51,7 @@ public void receivedGamer(GamerDTO gamer) {
(gamer.quizGameId(), redisUtil.getAllMemberScores(gamer.quizGameId())));
}

@KafkaListener(topics = ConstantUtil.QUIZ_QUESTION, groupId = "group-id", containerFactory = "questionRequestContainerFactory")
@KafkaListener(topics = ConstantUtil.QUIZ_QUESTION, groupId = "group-3", containerFactory = "questionRequestContainerFactory")
public void receivedQuestion(QuestionRequest request) {
log.info("๋ณด๋‚ด์ค˜์•ผ ํ•  ์งˆ๋ฌธ ์ƒ์„ธ={}", request.toString());

Expand All @@ -60,7 +60,7 @@ public void receivedQuestion(QuestionRequest request) {
request.quizGameId(), request.id()));
}

@KafkaListener(topics = ConstantUtil.QUIZ_ANSWER, groupId = "group-id", containerFactory = "answerResponseContainerFactory")
@KafkaListener(topics = ConstantUtil.QUIZ_ANSWER, groupId = "group-4", containerFactory = "answerResponseContainerFactory")
public void receivedAnswer(AnswerResponse response) {
log.info("๋ณด๋‚ด์ค˜์•ผํ•  ๋‹ต ์ƒ์„ธ={}", response.toString());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class ListenerConfig {

// KafkaListener ์ปจํ…Œ์ด๋„ˆ ํŒฉํ† ๋ฆฌ๋ฅผ ์ƒ์„ฑํ•˜๋Š” Bean ๋ฉ”์„œ๋“œ
@Bean
ConcurrentKafkaListenerContainerFactory<String, Message> kafkaListenerContainerFactory() {
ConcurrentKafkaListenerContainerFactory<String, Message> chatContainerFactory() {
ConcurrentKafkaListenerContainerFactory<String, Message> factory = new ConcurrentKafkaListenerContainerFactory<>();
factory.setConsumerFactory(consumerFactory());
return factory;
Expand Down Expand Up @@ -72,7 +72,7 @@ public ConsumerFactory<String, GamerDTO> gamerDTOConsumerFactory() {
Map<String, Object> consumerConfigurations =
ImmutableMap.<String, Object>builder()
.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaUrl)
.put(ConsumerConfig.GROUP_ID_CONFIG, kafkaGroup)
.put(ConsumerConfig.GROUP_ID_CONFIG, "group-2")
.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class)
.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, deserializer)
.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "latest")
Expand All @@ -99,7 +99,7 @@ public ConsumerFactory<String, QuestionRequest> questionRequestConsumerFactory()
Map<String, Object> consumerConfigurations =
ImmutableMap.<String, Object>builder()
.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaUrl)
.put(ConsumerConfig.GROUP_ID_CONFIG, kafkaGroup)
.put(ConsumerConfig.GROUP_ID_CONFIG, "group-3")
.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class)
.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, deserializer)
.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "latest")
Expand All @@ -125,7 +125,7 @@ public ConsumerFactory<String, AnswerResponse> answerResponseConsumerFactory() {
Map<String, Object> consumerConfigurations =
ImmutableMap.<String, Object>builder()
.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaUrl)
.put(ConsumerConfig.GROUP_ID_CONFIG, kafkaGroup)
.put(ConsumerConfig.GROUP_ID_CONFIG, "group-4")
.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class)
.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, deserializer)
.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "latest")
Expand Down

0 comments on commit 156148a

Please sign in to comment.