Skip to content

DMUGradWork/dating-query-service

Repository files navigation

Dating Query Service

데이팅 도메인의 쿼리 서비스 (데이팅 이벤트 조회 전담)

🔧 환경 설정

  • 포트: 8086
  • 데이터베이스: MongoDB (localhost:27017)
  • Kafka: localhost:9092 (이벤트 구독)
  • Framework: Spring Boot 3.5.4, Java 21

📡 이벤트 구독

CQRS Query Side로서 Command Service의 모든 이벤트를 구독하여 Read Model 업데이트:

이벤트 타입 Kafka Topic 처리 상태 Read Model 업데이트
DatingMeetingCreated grewmeet.dating.meeting.created ✅ 완료 DatingEvent 생성
DatingMeetingUpdated grewmeet.dating.meeting.updated ✅ 완료 DatingEvent 업데이트
DatingMeetingDeleted grewmeet.dating.meeting.deleted ✅ 완료 상태 → CANCELLED
ParticipantJoined grewmeet.dating.participant.joined ✅ 완료 EventParticipant 생성
ParticipantLeft grewmeet.dating.participant.left ✅ 완료 EventParticipant 탈퇴

🚀 실행

./gradlew bootRun

📋 API 엔드포인트

이벤트 조회

  • GET /events - 이벤트 목록 조회 (페이징)

    • Query: page, size
  • GET /events/{meetingUuid} - 이벤트 상세 조회

    • Path: meetingUuid (UUID)
  • GET /events/{meetingUuid}/participants - 참여자 목록

    • Path: meetingUuid (UUID)
  • GET /events/search - 이벤트 검색

    • Query: keyword, location, page, size

사용자별 조회

  • GET /users/me/events - 내 참여 이벤트
    • Header: X-User-Id (UUID)

🗄️ Read Model (MongoDB)

DatingEvent Collection

{
  "_id": "ObjectId(...)",
  "meetingUuid": "550e8400-e29b-41d4-a716-446655440000",
  "title": "인코딩 테스트 미팅",
  "description": "한글 확인",
  "hostAuthUserId": "550e8400-e29b-41d4-a716-446655440000",
  "hostNickname": "테스트호스트",
  "meetingDateTime": "2025-12-01T19:00:00",
  "location": "서울시 강남구",
  "maxMaleParticipants": 5,
  "maxFemaleParticipants": 5,
  "currentMaleParticipants": 0,
  "currentFemaleParticipants": 0,
  "status": "ACTIVE",
  "createdAt": "2025-11-04T18:14:48",
  "updatedAt": "2025-11-04T18:14:48"
}

EventParticipant Collection

{
  "_id": "ObjectId(...)",
  "meetingUuid": "550e8400-e29b-41d4-a716-446655440000",
  "authUserId": "550e8400-e29b-41d4-a716-446655440001",
  "gender": "MALE",
  "status": "ACTIVE",
  "joinedAt": "2025-11-04T18:30:00"
}

🏗️ 아키텍처

  • CQRS Query Side (읽기 전용)
  • Event-Driven (Kafka Consumer)
  • Eventually Consistent (최종 일관성)
  • MongoDB (조회 최적화)

🔑 핵심 특징

  • UUID 기반 식별 (meetingUuid)
  • 성별별 참여 인원 추적
  • 한글 UTF-8 완벽 지원
  • Soft Delete (CANCELLED 상태)
  • 중복 이벤트 처리 방지

🎯 이벤트 처리 플로우

  1. Kafka에서 이벤트 수신
  2. 중복 확인 (meetingUuid 기반)
  3. MongoDB Read Model 업데이트
  4. 참여 인원수 자동 계산
  5. 상태 자동 관리 (ACTIVE → FULL)

About

데이팅 이벤트의 조회 기능 중심의 서비스

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors