RequestHeader 처리
SubscribeResponseVo → builder 아래로 이동
kafka 처리에 대해 Alarm -> Nofitication 적용, producer 처리
@KafkaListener(topics = "feed-create"
, groupId = "feed-join-subscribe"
, containerFactory = "feedEventListenerContainerFactory")
public void consumeFeedEvent(FeedKafkaRequestDto kafkaFeedRequestDto) {
log.info("consumeFeedEvent: {}", kafkaFeedRequestDto.getContent());
List<Subscribe> authorUuidList = subscribeRepository.findByAuthorUuid(kafkaFeedRequestDto.getUuid());
List<String> receiverUuidList = authorUuidList
.stream()
.map(Subscribe::getSubscriberUuid)
.toList();
String splitedContent = kafkaFeedRequestDto.getContent().length() > 20 ? kafkaFeedRequestDto.getContent().substring(0, 20) + "..." : kafkaFeedRequestDto.getContent();
//AlarmKafkaRequestDto kafkaAlarmRequestDto = AlarmKafkaRequestDto.toDto(kafkaFeedRequestDto, receiverUuidList, splitedContent, TYPE);
NotificationKafkaRequestDto notificationKafkaRequestDto = NotificationKafkaRequestDto.toDto(kafkaFeedRequestDto, receiverUuidList,
splitedContent, TYPE);
sendMessage("feed-create-join-subscribe", notificationKafkaRequestDto);
}
public void sendMessage(String topic, NotificationKafkaRequestDto kafkaAlarmRequestDto) {
kafkaTemplate.send(topic, kafkaAlarmRequestDto);
}
}