Skip to content

Commit

Permalink
πŸ‘” Message 컨슈밍 μƒ˜ν”Œ 둜직 (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
jun108059 committed Aug 14, 2022
1 parent 74f8321 commit 7eb8c2d
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package hexagonal.socket.kafka.service;

import hexagonal.socket.kafka.config.KafkaConstants;
import hexagonal.socket.dto.Message;
import lombok.RequiredArgsConstructor;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class ConsumerService {

private final SimpMessagingTemplate template;

@KafkaListener(topics = KafkaConstants.KAFKA_TOPIC, groupId = KafkaConstants.CONSUMER_GROUP_ID)
public void consumerMessage(Message message) {
System.out.println("chatting : " + message.toString());
template.convertAndSend("/topic/group", message);
}
}


0 comments on commit 7eb8c2d

Please sign in to comment.