kafka 설정변경

This commit is contained in:
Hyowon Yang
2025-10-27 14:42:03 +09:00
parent 4197c72af5
commit 180e5978a0
10 changed files with 374 additions and 12 deletions
@@ -21,9 +21,14 @@
<entry key="REDIS_PASSWORD" value="Hi5Jessica!" />
<entry key="REDIS_DATABASE" value="5" />
<!-- Kafka Configuration -->
<!-- Kafka Configuration (원격 서버) -->
<entry key="KAFKA_ENABLED" value="true" />
<entry key="KAFKA_BOOTSTRAP_SERVERS" value="20.249.182.13:9095,4.217.131.59:9095" />
<entry key="KAFKA_CONSUMER_GROUP_ID" value="analytics-service-consumers" />
<!-- Sample Data Configuration (MVP Only) -->
<!-- ⚠️ Kafka Producer로 이벤트 발행 (Consumer가 처리) -->
<entry key="SAMPLE_DATA_ENABLED" value="true" />
<!-- Server Configuration -->
<entry key="SERVER_PORT" value="8086" />
@@ -84,9 +84,13 @@ public class SampleDataLoader implements ApplicationRunner {
try {
// 1. EventCreated 이벤트 발행 (3개 이벤트)
publishEventCreatedEvents();
log.info("⏳ EventStats 생성 대기 중... (2초)");
Thread.sleep(2000); // EventCreatedConsumer가 EventStats 생성할 시간
// 2. DistributionCompleted 이벤트 발행 (각 이벤트당 4개 채널)
publishDistributionCompletedEvents();
log.info("⏳ ChannelStats 생성 대기 중... (1초)");
Thread.sleep(1000); // DistributionCompletedConsumer가 ChannelStats 생성할 시간
// 3. ParticipantRegistered 이벤트 발행 (각 이벤트당 다수 참여자)
publishParticipantRegisteredEvents();
@@ -100,9 +104,9 @@ public class SampleDataLoader implements ApplicationRunner {
log.info(" - ParticipantRegistered: 180건 (MVP 테스트용)");
log.info("========================================");
// Consumer 처리 대기 (3초)
log.info("Consumer 처리 대기 중... (3초)");
Thread.sleep(3000);
// Consumer 처리 대기 (2초)
log.info("참여자 수 업데이트 대기 중... (2초)");
Thread.sleep(2000);
// 4. TimelineData 생성 (시간대별 데이터)
createTimelineData();
@@ -38,7 +38,7 @@ public class DistributionCompletedConsumer {
/**
* DistributionCompleted 이벤트 처리 (설계서 기준 - 여러 채널 배열)
*/
@KafkaListener(topics = "sample.distribution.completed", groupId = "analytics-service")
@KafkaListener(topics = "sample.distribution.completed", groupId = "${spring.kafka.consumer.group-id}")
public void handleDistributionCompleted(String message) {
try {
log.info("📩 DistributionCompleted 이벤트 수신: {}", message);
@@ -35,7 +35,7 @@ public class EventCreatedConsumer {
/**
* EventCreated 이벤트 처리 (MVP용 샘플 토픽)
*/
@KafkaListener(topics = "sample.event.created", groupId = "analytics-service")
@KafkaListener(topics = "sample.event.created", groupId = "${spring.kafka.consumer.group-id}")
public void handleEventCreated(String message) {
try {
log.info("📩 EventCreated 이벤트 수신: {}", message);
@@ -35,7 +35,7 @@ public class ParticipantRegisteredConsumer {
/**
* ParticipantRegistered 이벤트 처리 (MVP용 샘플 토픽)
*/
@KafkaListener(topics = "sample.participant.registered", groupId = "analytics-service")
@KafkaListener(topics = "sample.participant.registered", groupId = "${spring.kafka.consumer.group-id}")
public void handleParticipantRegistered(String message) {
try {
log.info("📩 ParticipantRegistered 이벤트 수신: {}", message);
@@ -41,10 +41,10 @@ spring:
max-wait: -1ms
database: ${REDIS_DATABASE:5}
# Kafka
# Kafka (원격 서버 사용)
kafka:
enabled: ${KAFKA_ENABLED:false}
bootstrap-servers: ${KAFKA_BOOTSTRAP_SERVERS:4.217.131.59:9095}
enabled: ${KAFKA_ENABLED:true}
bootstrap-servers: ${KAFKA_BOOTSTRAP_SERVERS:20.249.182.13:9095,4.217.131.59:9095}
consumer:
group-id: ${KAFKA_CONSUMER_GROUP_ID:analytics-service}
auto-offset-reset: earliest