kt-event-marketing/tools/check-kafka-messages.ps1
Hyowon Yang 4c8165bd20 샘플 토픽명으로 변경 (sample. 접두사 추가)
- 다른 서비스 개발자들의 운영 토픽과 충돌 방지
- MVP용 샘플 토픽: sample.event.created, sample.participant.registered, sample.distribution.completed
- KafkaTopicConfig, SampleDataLoader, 3개 Consumer 모두 업데이트

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 15:15:30 +09:00

64 lines
2.1 KiB
PowerShell

# Kafka 메시지 확인 스크립트 (Windows PowerShell)
#
# 사용법: .\check-kafka-messages.ps1
$KAFKA_SERVER = "4.230.50.63:9092"
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "📊 Kafka 토픽 메시지 확인" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
# Kafka 설치 확인
$kafkaPath = Read-Host "Kafka 설치 경로를 입력하세요 (예: C:\kafka)"
if (-not (Test-Path "$kafkaPath\bin\windows\kafka-console-consumer.bat")) {
Write-Host "❌ Kafka가 해당 경로에 설치되어 있지 않습니다." -ForegroundColor Red
exit 1
}
Write-Host "✅ Kafka 경로 확인: $kafkaPath" -ForegroundColor Green
Write-Host ""
# 토픽 선택
Write-Host "확인할 토픽을 선택하세요:" -ForegroundColor Yellow
Write-Host " 1. event.created (이벤트 생성)"
Write-Host " 2. participant.registered (참여자 등록)"
Write-Host " 3. distribution.completed (배포 완료)"
Write-Host " 4. 모두 확인"
Write-Host ""
$choice = Read-Host "선택 (1-4)"
$topics = @()
switch ($choice) {
"1" { $topics = @("event.created") }
"2" { $topics = @("participant.registered") }
"3" { $topics = @("distribution.completed") }
"4" { $topics = @("event.created", "participant.registered", "distribution.completed") }
default {
Write-Host "❌ 잘못된 선택입니다." -ForegroundColor Red
exit 1
}
}
# 각 토픽별 메시지 확인
foreach ($topic in $topics) {
Write-Host ""
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "📩 토픽: $topic" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
# 최근 5개 메시지만 확인
& "$kafkaPath\bin\windows\kafka-console-consumer.bat" `
--bootstrap-server $KAFKA_SERVER `
--topic $topic `
--from-beginning `
--max-messages 5 `
--timeout-ms 5000 2>&1 | Out-String | Write-Host
Write-Host ""
}
Write-Host "✅ 확인 완료!" -ForegroundColor Green