analytics-백엔드테스트완료
This commit is contained in:
+16
-7
@@ -14,6 +14,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -51,6 +52,7 @@ public class SampleDataLoader implements ApplicationRunner {
|
||||
private final ChannelStatsRepository channelStatsRepository;
|
||||
private final TimelineDataRepository timelineDataRepository;
|
||||
private final EntityManager entityManager;
|
||||
private final RedisTemplate<String, String> redisTemplate;
|
||||
|
||||
private final Random random = new Random();
|
||||
|
||||
@@ -81,16 +83,23 @@ public class SampleDataLoader implements ApplicationRunner {
|
||||
log.info("✅ 기존 데이터 삭제 완료");
|
||||
}
|
||||
|
||||
// Redis 멱등성 키 삭제 (새로운 이벤트 처리를 위해)
|
||||
log.info("Redis 멱등성 키 삭제 중...");
|
||||
redisTemplate.delete("processed_events");
|
||||
redisTemplate.delete("distribution_completed");
|
||||
redisTemplate.delete("processed_participants");
|
||||
log.info("✅ Redis 멱등성 키 삭제 완료");
|
||||
|
||||
try {
|
||||
// 1. EventCreated 이벤트 발행 (3개 이벤트)
|
||||
publishEventCreatedEvents();
|
||||
log.info("⏳ EventStats 생성 대기 중... (2초)");
|
||||
Thread.sleep(2000); // EventCreatedConsumer가 EventStats 생성할 시간
|
||||
log.info("⏳ EventStats 생성 대기 중... (5초)");
|
||||
Thread.sleep(5000); // EventCreatedConsumer가 EventStats 생성할 시간
|
||||
|
||||
// 2. DistributionCompleted 이벤트 발행 (각 이벤트당 4개 채널)
|
||||
publishDistributionCompletedEvents();
|
||||
log.info("⏳ ChannelStats 생성 대기 중... (1초)");
|
||||
Thread.sleep(1000); // DistributionCompletedConsumer가 ChannelStats 생성할 시간
|
||||
log.info("⏳ ChannelStats 생성 대기 중... (3초)");
|
||||
Thread.sleep(3000); // DistributionCompletedConsumer가 ChannelStats 생성할 시간
|
||||
|
||||
// 3. ParticipantRegistered 이벤트 발행 (각 이벤트당 다수 참여자)
|
||||
publishParticipantRegisteredEvents();
|
||||
@@ -104,9 +113,9 @@ public class SampleDataLoader implements ApplicationRunner {
|
||||
log.info(" - ParticipantRegistered: 180건 (MVP 테스트용)");
|
||||
log.info("========================================");
|
||||
|
||||
// Consumer 처리 대기 (2초)
|
||||
log.info("⏳ 참여자 수 업데이트 대기 중... (2초)");
|
||||
Thread.sleep(2000);
|
||||
// Consumer 처리 대기 (5초)
|
||||
log.info("⏳ 참여자 수 업데이트 대기 중... (5초)");
|
||||
Thread.sleep(5000);
|
||||
|
||||
// 4. TimelineData 생성 (시간대별 데이터)
|
||||
createTimelineData();
|
||||
|
||||
@@ -57,9 +57,11 @@ spring:
|
||||
acks: all
|
||||
retries: 3
|
||||
properties:
|
||||
connections.max.idle.ms: 10000
|
||||
request.timeout.ms: 5000
|
||||
session.timeout.ms: 10000
|
||||
connections.max.idle.ms: 540000
|
||||
request.timeout.ms: 30000
|
||||
session.timeout.ms: 30000
|
||||
heartbeat.interval.ms: 3000
|
||||
max.poll.interval.ms: 300000
|
||||
|
||||
# Sample Data (MVP Only)
|
||||
# ⚠️ 실제 운영: false로 설정 (다른 서비스들이 이벤트 발행)
|
||||
|
||||
Reference in New Issue
Block a user