authorUuidList = subscribeRepository.findByAuthorUuid(kafkaFeedRequestDto.getUuid()); List 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);"> authorUuidList = subscribeRepository.findByAuthorUuid(kafkaFeedRequestDto.getUuid()); List 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);"> authorUuidList = subscribeRepository.findByAuthorUuid(kafkaFeedRequestDto.getUuid()); List 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);">
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);
  • 위 코드에서는 kafkaFeedRequestDto.getContent() 가 여러번 호출되고 있음

    → 이를 변수를 통해 처리 (feedContent)